Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

Commit

Permalink
Cron for routine backups
Browse files Browse the repository at this point in the history
  • Loading branch information
cggaurav committed Feb 5, 2016
1 parent e7f147a commit ed7306c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion 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
Expand Down
7 changes: 7 additions & 0 deletions run.sh
Expand Up @@ -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

0 comments on commit ed7306c

Please sign in to comment.