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 break fi i=$(($i + 1)) fi fi done