Skip to content

Instantly share code, notes, and snippets.

@icyflame
Last active January 6, 2016 14:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icyflame/7d1b97ebca2bab0b3cde to your computer and use it in GitHub Desktop.
Save icyflame/7d1b97ebca2bab0b3cde to your computer and use it in GitHub Desktop.
Suggested Crontab file for a Students' Alumni Cell, IIT Kharagpur server

Crontab file

# m h  dom mon dow   command
10 * * * * cd path-to-website && git pull --ff-only upstream gh-pages
11 * * * * cd path-to-website && git pull --ff-only upstream master
12 * * * * cd /home/<username>/database-backups/ && mysqldump -ubackup_user -p<password> <database-name> > <database-name>-`date +%Y-%m-%d`.sql && gist -u <gist-id> `ls -t | head -1`
30 12 * * 1 cd /home/<username>/database-backups/ && rm -rf *.sql

Pre-req for the crontab to run

cd
mkdir -p database-backups
# ensure that the HTTP and HTTPS proxies are exported
printenv | grep -i http
# ensure that gem is installed
gem --version
# if gem is installed, install the gist gem
# https://github.com/defunkt/gist
sudo -E gem install gist
# if this installation completes without errors
# login to the gem
gist --login
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment