I thought I would document how I got the following scheduled jobs working on my clients RapidHosts hosting. It involved a lot of trial & error to get them going so thought I should share them. (Note: You’ll obviously need to change the web directory, back up folders & db credentials to suit your setup)
The following runs a MySQL DB backup and stores it as a date stamped gzip file
/usr/bin/mysqldump -u username dbname -ppassword |gzip> /var/www/vhosts/yoursite.co.uk/httpsdocs/backups/BACKUP.`date +”\%Y-\%m-\%d”`.gz
The following runs a full file backup and stores it as a date stamped tar file
tar -cvpzf /var/www/vhosts/yoursite.co.uk/httpsdocs/backups/`date +”\%Y-\%m-\%d”`.tar /var/www/vhosts/yoursite.co.uk/httpdocs/
The following runs a scheduled email reminder to customers
/usr/bin/php -q /var/www/vhosts/yoursite.co.uk/httpdocs/sendEmail.php
(sendEmail.php is the php file that contains the email logic)
As far as schedules go I have the first two running as a weekly job running on Sundays – whereas the reminder email is going out daily.
Obviously let me know if you can find a better way of doing this!