crontab 定时任务

1 linux 系统需要安装crontab ;yum install vixie-cron crontabs

2  

编写shell 脚本,

save_dir=/var/local/mysqlbak/
NewFile="$save_dir"'yitingchat_'$(date +%Y%m%d).sql
mysqldump -uUser -pPassword databaseName >$NewFile

4 给该脚本权限chmod 755 脚本.sh 

01 3 * * * root /sh脚本位置;定时每天三点执行脚本

  crontab用法:http://linuxso.com/command/crontab.html

 

查看crontabs 启动状态service crond status

查看crontab 任务列表 crontab -l

删除任务 crontab -r

 

posted @ 2016-06-12 21:22  jackylee92  阅读(115)  评论(0编辑  收藏  举报