Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
$ crontab -l
#
# m h  dom mon dow   command

SHELL=/bin/bash

* * * * * (/usr/bin/curl -s -XPOST http://internal.ip -H 'Content-type: application/json' -d 'data')

$ ls -l /usr/bin/curl
-rwxr-xr-x 1 root root 123336 Jan 29  2012 /usr/bin/curl

$ uname -a
Linux machine 2.6.32-5-amd64 #1 SMP Mon Jan 16 16:22:28 UTC 2012 x86_64 GNU/Linux

$ cat /etc/debian_version
6.0.4

But the command doesn't get executed, and I see the following in /var/log/syslog:

Nov 29 20:29:01 machine /USR/SBIN/CRON[28580]: (CRON) error (grandchild #28582 failed with exit status 1)

The exact same command, when run directly from terminal, works fine:

$ (/usr/bin/curl -s -XPOST http://internal.ip -H 'Content-type: application/json' -d 'data')
{}

I tried googling, but all I could find was that the command path must work (it does, I set an absolute path) and that there must be a new line at the end of crontab (there is). Any ideas?

share|improve this question
    
Uhm... how does one use verbatim formatting on a block of text? Without indenting every single line manually, that is. –  user124114 Nov 29 '12 at 19:45
1  
Highlight the text and click the {} button. It will indent everything for you. –  Shauna Nov 29 '12 at 19:47
add comment

1 Answer

you should not have SHELL=/bin/bash in the output of crontab -l.
run

crontab -e

and remove SHELL=/bin/bash from crontab.

share|improve this answer
    
No, I want the cron commands executed by bash, not sh (it gives the same result in this case, anyway). –  user124114 Nov 30 '12 at 9:56
add comment

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.