Denim-Bot/start.sh
2022-11-30 14:30:49 +01:00

30 lines
620 B
Bash

declare -a casy
i=0
while true
do
cas=$(date +"%s")
if node . $posel $posledni
then
echo stahuju update
git stash
git pull
npm i --omit=dev
tsc >/dev/null
unset posel
else
echo exit code byl $?
posel=1
casy[$i]=$(date +"%s")
posledni=$(($((casy[$i]))-$cas))
if (($i < 3)) || (($((casy[$(($i - 3))])) < $(($((casy[$i])) - 864000))))
then
echo Poslo to dostatecne malo, restartuju
else
echo Poslo to moc, seru na to
break
fi
i=$(($i+1))
fi
done