linux定时任务执行脚本
安装crontab
yum install cronie
yum install crontabs
添加定时任务
vim /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root# 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# 指定时间执行数据跑批文件,每天凌晨3点执行任务
0 3 * * * /bin/sh /root/file/commond/data_start.sh >> /root/commond_crontab/crontab.log 2>&1
# 每一个小时执行一次任务
0 */4 * * * /bin/sh /root/file/commond/sftp_upload_file.sh
启动定时任务
/sbin/service crond start
重启定时任务
/sbin/service crond restart
停止定时任务
/sbin/service crond stop
重新加载定时任务配置
/sbin/service crond reload
查看定时任务状态
service crond status
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
