crontab定时任务操作

一、查看定时任务

crontab -l

二、添加定时任务

crontab -e

(一)执行外部链接

 

//每隔10分钟执行1次
*/10 * * * * /usr/bin/curl "http://www.baidu.com/report/report.php

 

(二)执行内部文件

  1.php文件

//每天的6点、12点执行
0 6,12 * * *  /usr/bin/php /data/www/ixingmei/ixingmeib2c/api/first_or_last.php
0 6,12 * * *  /usr/bin/php url

  2.shell脚本

//整点、15、30、45分的时候执行
0,15,30,45 * * * * /bin/bash /data/www/ixingmei/flush_showing.sh

 

三、重启服务crontab进程

/etc/init.d/crond restart

 四、查看日志

tail -f /var/log/cron

 

posted on 2017-10-27 12:00  薇薇123456  阅读(160)  评论(0编辑  收藏  举报

导航