使用 crontab 运行两个命令 [英] Run two commands with a crontab
本文介绍了使用 crontab 运行两个命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个简单的问题.我需要使用自动 shell 脚本将 cron 添加到我的 debain crontab 中,并且我需要 cron 来做两件事:
- cd 进入/etc/application
- 运行命令scrapy crawl"
<块引用>
crontab -l |{/bin/cat;/bin/echo "* 3 * * * cd/etc/application";}|crontab -
如何让它也运行 scrapy crawl 命令?
解决方案
您可以在单个 crontab 行中包含多个命令.只需用分号分隔它们:
crontab -l |{/bin/cat;/bin/echo "* 3 * * * cd/etc/application ; scrapy crawl";} |crontab -
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:
- cd into /etc/application
- 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?
解决方案
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 -
这篇关于使用 crontab 运行两个命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文