Files
backupsidecar/src/entry.sh
2023-04-28 21:37:39 +02:00

18 lines
432 B
Bash

#!/bin/sh
mkdir /etc/cron.d
touch /etc/cron.d/backup
echo "$INTERVAL /bin/sh /app/backup.sh" > /etc/cron.d/backup
# change ownership and make the cron known to crontab
chmod 0644 /etc/cron.d/backup && crontab /etc/cron.d/backup
if [ $RUNONSTART = 'true' ]; then
echo $(date +"%Y-%m-%dT%T") "- Running initial backup"
/bin/sh /app/backup.sh
fi
# Wait until infinity
echo $(date +"%Y-%m-%dT%T") "- Starting cron"
crond -f