ubuntu 18.04定时任务设置到秒的方案

  • A+
所属分类:未分类

由于别人给做的爬虫py需要设置到30秒,所以,做个记录方案:

以下代码是实现周期为20s的定时任务,两种方式均可,但稍有不同。

修改用户的日常任务:crontab -e

* * * * * python3 /root/mane.py

* * * * * sleep 30; python3 /root/mane.py

ctrl+o(保持)  Ctrl+x(退出)
修改系统的定时任务:vim /etc/crontab

* * * * * root   python3 /root/mane.py

* * * * * root  sleep 30 && python3 /root/mane.py

 

weinxin
我的QQ群
这是我的QQ群扫一扫

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: