Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have this line in my crontab file

*/1 * * * * espeak 'foo' && espeak 'bar'

But only half of it, first command gets executed every minute.

While when I write this in the terminal it works like a charm.

Is there a different way to execute 2 commands in the same line in the crontab file ?

share|improve this question
    
First, use the full path to espeak in crontab. Second use ; rather then &&. command1; command2 –  bodhi.zazen Mar 7 '13 at 19:29

1 Answer 1

&& is interpreted by bash as one of the operators that separate pipelines in a command line. If you call those commands from bash both should run:

*/1 * * * * bash -c 'espeak "foo" && espeak "bar"'
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.