当前位置: 移动技术网 > 网络运营>服务器>Linux > centos 设置定时任务执行指定脚本的方法

centos 设置定时任务执行指定脚本的方法

2017年12月08日  | 移动技术网网络运营  | 我要评论

vim /etc/crontab

shell=/bin/bash
path=/sbin:/bin:/usr/sbin:/usr/bin
mailto=root
home=/

# for details see man 4 crontabs

# example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) or jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (sunday=0 or 7) or sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed

01 0 * * * root /data/backup/168/backup.sh
01 0 * * * root /data/backup/ty/backup.sh


vim /data/backup/168/backup.sh


rq=` date +%y%m%d%h%m%s`
mysqldump etdsprodb -uroot > /data/backup/168/etdsprodb_$rq.sql
 
rq=` date +%y%m%d%h%m%s`
mysqldump etdsreport -uroot > /data/backup/168/etdsreport_$rq.sql

rq=` date +%y%m%d%h%m%s`
svnadmin dump /data/svnrepos/etds|gzip  > /data/backup/168/svnetds_$rq.dump.tar.gz

以上这篇centos 设置定时任务执行指定脚本的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持移动技术网。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网