Welcome to WebmasterWorld Guest from 54.167.177.207

Forum Moderators: Ocean10000 & incrediBILL & phranque

Creating a bash script - DB Cron Job

   
12:05 pm on Mar 10, 2005 (gmt 0)

10+ Year Member



Hi,

I've got this line of code which enables me to backup the database on a daily basis. However this does not work and I know why after all this time.

You need to login as root to run the command, now I think I need to create a bash script that enables you to login as root and then run the command.

Then I suppose you need to setup a cron job so that it executes the bash script at a given time. Yeah?

This is the line of code:

30 09 * * * /usr/bin/mysqldump --opt -uusername -ppassword dbname gzip > /home/sites/domain.com/web/mysqlbackup_`date +\%d\%m\%y`.sql.gz

Any ideas?

Thanks.

Oz.

12:35 pm on Mar 10, 2005 (gmt 0)

10+ Year Member



Hi Oz,

Why don't you put that into root's crontab?

There again I don't see why this should fail, is there a permissions problem?

2:42 pm on Mar 10, 2005 (gmt 0)

10+ Year Member



IncyWincy, that worked a treat! thanks for that, I didn't think of using the root crontab.

Nice.

Oz.

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month