crontab

【crontab】

创建任务

crontab -e

如果无权创建,操作

chattr -isa /var/spool/cron

查看任务

crontab -l

查看状态

service crond status

启动服务

/sbin/service crond start

关闭服务

/sbin/service crond stop

重启服务

/sbin/service crond restart

参考任务

00 00 * * * curl https://xxx executed
00 */2 * * * curl https://xxx executed
*/5 * * * * curl https://xxx executed
* * * * * sleep 01; curl https:// executed
* * * * * sleep 20; curl https://www executed
* * * * * sleep 40; curl https://www executed
日志输出到文件
* * * * * php /home/1.php  >>/home/1.log
05 * * * * /bin/sh /home/beifen/h.sh executed
15 4 * * * /bin/sh /home/beifen/bf.sh executed
13 2 1 * * /bin/sh /home/beifen/bfyue.sh executed

你可能感兴趣的:(crontab)