Linux自动定时备份程序和Mysql数据库




   1,新建备份脚本文件:内容如下:

  vi /home/backup/autobackup.sh

  ----------------------

  tar -cvf /home/backup/www/source_$(date +%Y%m%d-%H%M%S).tar /usr/local/jakarta-tomcat-5.5.9/webapps/WebRoot//备份程序

  /usr/bin/mysqldump -uroot -p123456 dbname --skip-lock-tables> /home/backup/museum/data/museum_$(date +%Y%m%d-%H%M%S)//备份Mysql

  ----------------------

  2,//添加自动备份

  vi /etc/crontab:

  ----------------------

  00 12 * * * root /home/backup/autobackup.sh

  ----------------------

  3,restart crond

  ----------------------

  [root@hssib backup]# /etc/rc.d/init.d/crond restart

你可能感兴趣的:(tomcat,linux,mysql,脚本)