updated unix scripts

This commit is contained in:
2022-01-27 20:05:27 -06:00
parent 8d2ec0ce02
commit 9067a67bd5
2 changed files with 34 additions and 6 deletions

View File

@@ -1,14 +1,40 @@
#!/usr/bin/env bash
#!/bin/bash
#change to ccurrent directory
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
cd ../..
#colors
C1='\033[1;37m'
C2='\033[1;33m'
NC='\033[0m'
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
cd ../..
#make log folder
if [[ ! -d log ]]
then
mkdir log
fi
while true; do
npm start
printf "\n\n\n${C1}press ${C2}Control+C${C1} to close${NC}\n\n\n"
#current file number
num=0
if [[ -f log/number ]]
then
num=$(cat log/number)
fi
echo $num > log/number
#watchdog
while true
do
#increment log file number
num=$(( num + 1 ))
echo $num > log/number
#run
npm start >> log/$num.out 2> log/$num.err
#give chance to close program
sleep 5
printf "\n\n\n${C1}press ${C2}Control+C${C1} to close${NC}\n\n\n"
done