From ed7306c88b6ee3a87967be6aac64bb32140e156f Mon Sep 17 00:00:00 2001 From: Gaurav C Date: Fri, 5 Feb 2016 17:35:30 +0100 Subject: [PATCH] Cron for routine backups --- backup.sh | 2 +- run.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/backup.sh b/backup.sh index de53da1..359acea 100755 --- a/backup.sh +++ b/backup.sh @@ -1,5 +1,5 @@ #!/bin/bash - +export PATH=$PATH:/usr/bin:/usr/local/bin:/bin # Get timestamp : ${BACKUP_SUFFIX:=.$(date +"%Y-%m-%d-%H-%M-%S")} readonly tarball=$BACKUP_NAME$BACKUP_SUFFIX.tar.gz diff --git a/run.sh b/run.sh index fed4e84..8af6650 100755 --- a/run.sh +++ b/run.sh @@ -5,3 +5,10 @@ if [[ "$RESTORE" == "true" ]]; then else ./backup.sh fi + +if [ -n "$CRON_TIME" ]; then + echo "${CRON_TIME} /backup.sh >> /dockup.log 2>&1" > /crontab.conf + crontab /crontab.conf + echo "=> Running dockup backups as a cronjob for ${CRON_TIME}" + exec cron -f +fi