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,8 +6,9 @@ cd "$(dirname "$(realpath "$0")")"
interval="6h" interval="6h"
while true function run {
do while true
do
until ping -c 1 '0.0.0.0' > /dev/null until ping -c 1 '0.0.0.0' > /dev/null
do echo "[run-loop] waiting for internet connection." do echo "[run-loop] waiting for internet connection."
done done
@ -17,4 +18,11 @@ do
echo "[run-loop] Waiting $interval from" echo "[run-loop] Waiting $interval from"
echo " $(date)" echo " $(date)"
sleep "$interval" sleep "$interval"
done done
}
if [ -t 1 ]
then run
else run >> output.log
fi