Monday, April 29, 2013

Backup database with Crontab

How to backup database with schedule. here the codes. First let's create a chunk of codes to backup
nano /home/arul/backup_database.sh
and type these code:
mysqldump -u dbuser -pdbpass dbname > /home/arul/backup/file_name_backup_`date +\%Y%m%d`.sql
then let's set the schedule to execute the code with Crontab
firstly, edit your crontab.
crontab -e
type the code:
0 0 * * * /home/arul/backup_database.sh
You can list crontab execution code with:
crontab -l

No comments:

Post a Comment