CentOS 安装 crontab

发布于 2015-09-28 / Linux / 0条评论 / 1,183浏览

crontab一个很不错的工具
安装

# yum install crontabs

启动服务

# service crond start

重新载入配置

# service crond reload

重启

# service crond restart

停止

# service crond stop

设置开机启动

# chkconfig --level 35 crond on

查看是否成功

# ntsysv

配置参考Example 就好了

# cd /etc
# cat 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

但是不是直接编辑crontab
而是

# crontab -e 
# */1 * * * * echo "hello world"

然就一分钟输出一次holle world

评论
站长统计