Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run two commands with a 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:

  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?

like image 980
J.Zil Avatar asked Aug 21 '13 21:08

J.Zil


1 Answers

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 -
like image 107
Jim Lewis Avatar answered Oct 25 '22 00:10

Jim Lewis