28 lines
426 B
Bash
Executable file
28 lines
426 B
Bash
Executable file
#!/usr/bin/bash
|
|
set -e
|
|
cd "$(dirname "$(realpath "$0")")"
|
|
|
|
|
|
interval="6h"
|
|
|
|
|
|
function run {
|
|
while true
|
|
do
|
|
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
|
|
}
|
|
|
|
|
|
if [ -t 1 ]
|
|
then run
|
|
else run >> output.log
|
|
fi
|