Example: How to Run a Cron job
Short example on how to create a crontab entry.
First create a script to run via cron:
vim mysqldump_cron.sh
#!/bin/bash
# ----------------------------------------------------------------------
# dumps mysql into a file, ready for rsync retrieval
mysqldump -u root tuxtrain > /var/www/wordpress/tuxtrain.sql.
And save the file. Then make the file executable:
chmod a+x mysqldump_cron.sh
Then create the cron file:
vim mysql.cron
0 19 * * * /home/username/mysqldump_cron.sh
and exit the file.
The line works like this: min hour dayofmonth month dayofweek command
Then tell crontab to use the file:
crontab mysql.cron
Do a crontab -l to see if it’s now scheduled. If you wish to remove all the user’s crontab entries type:
crontab -r







