Thursday, January 23, 2014

cron job

0 1 * * *   /bin/backup.sh
@daily root /bin/code.sh

code.sh

cd /path-to-file
tar -cvf drk-`date +%Y%m%d`.tar.gz  /path-to-file

backup.sh

#!/bin/sh
#backup.sh
ldir=$(mysqldump --routines --single-transaction -u Username -ppassword dbname > /path-to-file/drk_`date +"\%Y\%m\%d\%H\%M\%S"`.sql);

No comments:

Post a Comment