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

30 00 * * * root bash /root/code/Crawler/Crawler/SpiderTask.sh

38 14 16 * * root bash /root/code/UserLabel/UserLabelStart.sh

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


如上所示为/etc/crontab文件中内容,公司服务器为centos。根据上图可知,前5个*为定时器执行时间配置,后面紧跟着执行用户名,后紧跟着要执行的命令。

配置完成后,可使用以下命令进行crond服务动作:

service crond start 启动服务

service crond stop 停止服务

service crond restart 重启服务

service crond reload 重新加载配置

执行命令时注意权限问题!!!

你可能感兴趣的:(crontab简单使用手册)