CentOS sets the method of timing task to execute the specified script

Time:2020-11-27

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

The above CentOS method for setting the scheduled task to execute the specified script is the whole content shared by Xiaobian. I hope it can give you a reference, and I hope you can support developeppaer more.