Add source

This commit is contained in:
Andras Schmelczer 2024-05-23 08:04:58 +01:00
parent b781c17c5a
commit 1b95abb89f
3 changed files with 110 additions and 0 deletions

20
src/schedule.sh Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash
SLEEP_TIME=${SLEEP_TIME:-1h}
log_message() {
stdbuf -o0 tee -a "$(get_log_file_name)"
}
get_log_file_name() {
echo "/backup-logs/backup_$(date +%Y)_week_$(date +%U).log"
}
echo "Starting schedule script at `date`" | log_message
while true; do
exec /src/backup-wrapper.sh 2>&1 | log_message
echo "Sleeping for $SLEEP_TIME" | log_message
sleep "$SLEEP_TIME"
done