This is a discussion on Cron Backup of Database within the MySQL forums, part of the Database Server Software category; --> Can anyone give me a link containing data that explains the correct procedure for setting up a batch file ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| On Wed, 20 Feb 2008 13:01:07 -0500, Fred Atkinson wrote: > Can anyone give me a link containing data that explains the > correct procedure for setting up a batch file to backup and InnoDB > database and set that file to execute using Cron on my Website? crontab -e Make it look something like: # Back up altgothic database conveniently. 49 22 * * * mysqldump -uthe_user -pthe_password --opt --databases altgothic >~/tmp/altgothic`date +\%d`.sql This one runs every day at 22:49, stores data in a rotating set of backup files. User your own appropriate options. From this point, the automatic backing up of the homedirs to tape solves the rest of the problem. -- "The last refuge of the insomniac is a sense of superiority to the sleeping world." --Leonard Cohen, The Favourite Game |
| |||
| On Wed, 20 Feb 2008 12:58:55 -0600, "Peter H. Coffin" <hellsop@ninehells.com> wrote: >On Wed, 20 Feb 2008 13:01:07 -0500, Fred Atkinson wrote: >> Can anyone give me a link containing data that explains the >> correct procedure for setting up a batch file to backup and InnoDB >> database and set that file to execute using Cron on my Website? > >crontab -e > >Make it look something like: > ># Back up altgothic database conveniently. >49 22 * * * mysqldump -uthe_user -pthe_password --opt --databases altgothic >~/tmp/altgothic`date +\%d`.sql > > >This one runs every day at 22:49, stores data in a rotating set of >backup files. User your own appropriate options. From this point, the >automatic backing up of the homedirs to tape solves the rest of the >problem. I'm not very experienced with Cron. I was attempting to do it in CPanel at the Cron icon. I would surely appreciate a link to directions on how to do it that way. Regards, Fred |
| |||
| On Wed, 20 Feb 2008 16:19:24 -0500, Fred Atkinson wrote: > On Wed, 20 Feb 2008 12:58:55 -0600, "Peter H. Coffin" ><hellsop@ninehells.com> wrote: > >>On Wed, 20 Feb 2008 13:01:07 -0500, Fred Atkinson wrote: >>> Can anyone give me a link containing data that explains the >>> correct procedure for setting up a batch file to backup and InnoDB >>> database and set that file to execute using Cron on my Website? >> >>crontab -e >> >>Make it look something like: >> >># Back up altgothic database conveniently. >>49 22 * * * mysqldump -uthe_user -pthe_password --opt --databases altgothic >~/tmp/altgothic`date +\%d`.sql >> >> >>This one runs every day at 22:49, stores data in a rotating set of >>backup files. User your own appropriate options. From this point, the >>automatic backing up of the homedirs to tape solves the rest of the >>problem. > > I'm not very experienced with Cron. I was attempting to do it > in CPanel at the Cron icon. I would surely appreciate a link to > directions on how to do it that way. Sorry, never touch the stuff, personally. I'm very much a CLI kind of fellow. -- 94. When arresting prisoners, my guards will not allow them to stop and grab a useless trinket of purely sentimental value. --Peter Anspach's list of things to do as an Evil Overlord |
| ||||
| On Wed, 20 Feb 2008 16:21:17 -0600, "Peter H. Coffin" <hellsop@ninehells.com> wrote: >On Wed, 20 Feb 2008 16:19:24 -0500, Fred Atkinson wrote: >> On Wed, 20 Feb 2008 12:58:55 -0600, "Peter H. Coffin" >><hellsop@ninehells.com> wrote: >> >>>On Wed, 20 Feb 2008 13:01:07 -0500, Fred Atkinson wrote: >>>> Can anyone give me a link containing data that explains the >>>> correct procedure for setting up a batch file to backup and InnoDB >>>> database and set that file to execute using Cron on my Website? >>> >>>crontab -e >>> >>>Make it look something like: >>> >>># Back up altgothic database conveniently. >>>49 22 * * * mysqldump -uthe_user -pthe_password --opt --databases altgothic >~/tmp/altgothic`date +\%d`.sql >>> >>> >>>This one runs every day at 22:49, stores data in a rotating set of >>>backup files. User your own appropriate options. From this point, the >>>automatic backing up of the homedirs to tape solves the rest of the >>>problem. >> >> I'm not very experienced with Cron. I was attempting to do it >> in CPanel at the Cron icon. I would surely appreciate a link to >> directions on how to do it that way. > >Sorry, never touch the stuff, personally. I'm very much a CLI kind of >fellow. My hosting provider solved it. Here is the final script (with the names of the user, password, and the database file changed for security reasons): #!/bin/sh # a script to dump the 'special' database to a file MYSQL=`which mysqldump` DATE=`date +%y%m%d` OUTPUT=/home/fred/database_backups/special_$DATE ${MYSQL} -ufred -ppassword -B siteusername_special -Q -c --add-drop-table >${OUTPUT}.sql I set it to run as a cron job. It seems to be working now. Regards, Fred |