Web Hosting Talk







View Full Version : Cron Job (Help)


Coastie
06-02-2002, 04:38 PM
I am trying to create a cron job on a RAQ4
It will dump, compress, and move to folder a backup of a mySQL database.

I can run this command via command line, and it works great

mysqldump -u root -pPASSWORD -q DATABASE| gzip > /xxx/xxx/xxx/web/backup/backup.$(date +%a).gz

When I create a text file called SQL_backup and place it in /etc/cron.hourly

and try to run it, I get the following error

[root cron.hourly]# crontab SQL_backup
"SQL_backup":2: bad minute
errors in crontab file, can't install.
[root cron.hourly]#

Can someone please provide me a script that will run?

Coastie
06-02-2002, 05:36 PM
OK, I am all set with the script. It is working

I do still have 1 question.

I am not the one who gets the root e-mail

I'd like to use the MAILTO= command to get a status of the backup.

I have not been able to accomplish that.

Where does the command go, and what is the proper syntax?

Does it so in the shell script, or does it do in the crontab file?

blacknight
06-02-2002, 09:03 PM
You can use either method to send an email.
If you want to use the crontab method the following should work:
(cd /xxx/xxx/; ./scripttorun 2>&1 | mail -s "script to run output" usernametogetmail)
Obviously you have to add the time in the correct format for crontab to recognise it