Denim-Bot/start.sh
2023-07-07 17:00:23 +02:00

33 lines
813 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
kod=$?
echo exit code byl $kod
if (($kod == 69)); then
echo jenom restart
else
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
echo osel$(date +"%s") >>zaznamy.dlog
break
fi
i=$(($i + 1))
fi
fi
done