例 *************************************************** 0 0 * * * /usr/bin/rdate -s rdate.darkorb.net *************************************************** 注意 被执行的文件需要为绝对路包含如 include("/home/wwwroot/testcron.php") *************************************************************** 安装crontab: 说明: 查看crontab服务状态:service crond status 手动启动crontab服务:service crond start 查看crontab服务是否已设置为开机启动,执行命令:ntsysv 加入开机自动启动:
功能说明:设置计时器。 语 法:crontab [-u <用户名称>][配置文件] 或 crontab [-u <用户名称>][-elr] 补充说明:cron是一个常驻服务,它提供计时器的功能,让用户在特定的时间得以执行预设的指令或程序。只要用户会编辑计时器的配置文件,就可以使用计时器的功能。其配置文件格式如下: 参 数: 2,crontab 格式 基本格式 : 第1列表示分钟1~59 每分钟用*或者 */1表示 crontab文件的一些例子: 30 21 * * * /usr/local/etc/rc.d/lighttpd restart 45 4 1,10,22 * * /usr/local/etc/rc.d/lighttpd restart 10 1 * * 6,0 /usr/local/etc/rc.d/lighttpd restart 0,30 18-23 * * * /usr/local/etc/rc.d/lighttpd restart 0 23 * * 6 /usr/local/etc/rc.d/lighttpd restart * */1 * * * /usr/local/etc/rc.d/lighttpd restart * 23-7/1 * * * /usr/local/etc/rc.d/lighttpd restart 0 11 4 * mon-wed /usr/local/etc/rc.d/lighttpd restart 0 4 1 jan * /usr/local/etc/rc.d/lighttpd restart */30 * * * * /usr/sbin/ntpdate 210.72.145.44 |
linux CentOS安装crontab及使用方法
猜你喜欢
转载自sinykk.iteye.com/blog/930031
今日推荐
周排行