Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
$ 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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .