add logging for non tty invokation

This commit is contained in:
Matthieu Jolimaitre 2024-11-24 17:22:04 +01:00
parent 35b32eabc0
commit bca6aa5734
2 changed files with 19 additions and 10 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
/data/token /data/token
/repo /repo
/venv /venv
/output.log

View file

@ -6,15 +6,23 @@ cd "$(dirname "$(realpath "$0")")"
interval="6h" interval="6h"
while true function run {
do while true
until ping -c 1 '0.0.0.0' > /dev/null do
do echo "[run-loop] waiting for internet connection." until ping -c 1 '0.0.0.0' > /dev/null
do echo "[run-loop] waiting for internet connection."
done
./run-rotate
echo "[run-loop] Waiting $interval from"
echo " $(date)"
sleep "$interval"
done done
}
./run-rotate
echo "[run-loop] Waiting $interval from" if [ -t 1 ]
echo " $(date)" then run
sleep "$interval" else run >> output.log
done fi