Gossamer Forum
Home : Products : Gossamer Links : Discussions :

using crontab to backup a mysql database

Quote Reply
using crontab to backup a mysql database
hi,
i am trying to do a daily backup of some mysql databases, so i made a text file, mysqulbackup, that looks like this:

#!/bin/sh
mysqldump -uroot -ppwd --opt db1 > /sqldata/db1.sql

with the appropriate names substituted for root, pwd, db1.
then i made another text file, cronstuff.txt, that looks like this:

0 * * * * /mysqldata/mysqlbackup [return]
[return]

(i am trying to test it by doing the backup every minute)
So then i telnet into my account and run crontab /cronstuff.txt, which i think sets up my crontab correctly ... when i type crontab -l, i see a file with the correct command in there.

but i wait, and no db1.sql is created in sqldata.
can anyone tell me what i might be doing wrong?

-ben
Quote Reply
Re: [kakatooie] using crontab to backup a mysql database In reply to
Your using a full path? My cron_manager makes this so much easier Laugh

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [kakatooie] using crontab to backup a mysql database In reply to
cron should spew out an error if it fails. You could send the output to a file.

0 * * * * /mysqldata/mysqlbackup > spew.out

I think you can do that anyway.

It should send an email to root though too if it fails.

I don't think you need --opt either.

Last edited by:

Paul: Jan 21, 2003, 2:38 PM