PHP菜鸟博客_共同学习分享PHP技术心得【PHP爱好者】
Ubuntu下用crontab部署定时任务
2017-2-27 菜鸟站长
linux下的crontab

写定时任务:

通过如下命令,就可以开启本用户的定时文件,文件存放在 /var/spool/cron/crontabs 文件夹下

并且以当前用户的名字命名的文件。



crontab -e

# m h  dom mon dow   command

 */1  *  *   *   *    curl  http://svnapi.wlphp.com/api.php         //每隔1分钟通过curl命令向url发送get请求

 */1  *  *    *   *     echo 11111>>wllog.txt                         //每隔1分钟向文件wllog.txt写入11111

    

wl2304@ubuntu:~$ /etc/init.d/cron   restart                         //重启cron服务

[ ok ] Restarting cron (via systemctl): cron.service.



crontab -e                      //编辑定时任务文件

/etc/init.d/cron  restart     //重启定时任务服务

 




发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容