Run two commands with a crontab

谁都会走 提交于 2019-12-08 15:29:45

问题


I have a quick question. I need to add a cron to my debain crontab using an automated shell script and I need the cron to do two things:

  1. cd into /etc/application
  2. run the command "scrapy crawl"

crontab -l | { /bin/cat; /bin/echo "* 3 * * * cd /etc/application"; } | crontab -

How do I get it to also run the scrapy crawl command?


回答1:


You can have multiple commands in a single crontab line. Just separate them with semicolons:

crontab -l | { /bin/cat; /bin/echo "* 3 * * * cd /etc/application ; scrapy crawl"; } | crontab -


来源:https://stackoverflow.com/questions/18367711/run-two-commands-with-a-crontab

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!