| Welcome to WebmasterWorld Guest from 18.104.22.168 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Pubcon Platinum Sponsor 2014|
|Creating a bash script - DB Cron Job|
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
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?
IncyWincy, that worked a treat! thanks for that, I didn't think of using the root crontab.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved