Hi folks, I've set up a script** to run from cron as below. This script runs from a terminal as it should, but won't run either from cron.d or from cron.hourly when stuffed in there. Can anyone see anything glaringly obviously wrong with it? It's run as /etc/cron.d/update-ip, with the following line: */5 * * * * root /bin/checkIP.sh **I'm sure it's a crappy script, but as long as it does the job..... ;-) Puzzled, Jenny #!/bin/sh #checks IP of courthouse every 5 mins and updates file on stoneboat /etc/ddns/courthouse-ip set -e currentIP=$(/usr/bin/wget -q -O - checkip.dyndns.org | sed -e 's/[^[:digit:]|.]//g') remote="stoneboat:/etc/ddns/" local="/tmp/courthouse-ip" echo $currentIP > $local >> /home/jenny/checkip.txt 2>&1 ##the last bit was put in to troubleshoot scp $local $remote exit 0
On 30 June 2010 15:15, Jenny Hopkins <hopkins.jenny@gmail.com> wrote:
I've set up a script** to run from cron as below. This script runs from a terminal as it should, but won't run either from cron.d or from cron.hourly when stuffed in there. Can anyone see anything glaringly obviously wrong with it?
It's run as /etc/cron.d/update-ip, with the following line: */5 * * * * root /bin/checkIP.sh
From the man page:
"The ``sixth'' field (the rest of the line) specifies the command to be run. " Your sixth field is "root" -- is this what you intended? Srdjan
On 30 June 2010 15:22, Srdjan Todorovic <todorovic.s@googlemail.com> wrote:
From the man page:
"The ``sixth'' field (the rest of the line) specifies the command to be run. "
Your sixth field is "root" -- is this what you intended?
Oops. I was following other working examples that state which user executes the command in this slot. I have removed it, but no difference. Martin:
Full path to scp?
No difference. Thanks, Jenny
On Wed, June 30, 2010 15:22, Srdjan Todorovic wrote:
From the man page:
"The ``sixth'' field (the rest of the line) specifies the command to be run. "
Your sixth field is "root" -- is this what you intended?
Systems crontabs are a tiny bit different to user crontabs. The system crontab needs to know the user a particular command should be run as.
On 30 Jun 15:22, Srdjan Todorovic wrote:
On 30 June 2010 15:15, Jenny Hopkins <hopkins.jenny@gmail.com> wrote:
I've set up a script** to run from cron as below. This script runs from a terminal as it should, but won't run either from cron.d or from cron.hourly when stuffed in there. Can anyone see anything glaringly obviously wrong with it?
It's run as /etc/cron.d/update-ip, with the following line: */5 * * * * root /bin/checkIP.sh
From the man page:
"The ``sixth'' field (the rest of the line) specifies the command to be run. "
Your sixth field is "root" -- is this what you intended?
Yes, it really was what she really meant... Now... Miss Hopkins... Are you sure that it's not being executed? Can you do a grep "CRON" /var/log/syslog, see if it's executing at all, if not then I wonder if it's one of my *favourite* cron.d issues... (oh, and that would *not* work in cron.daily, things in cron.daily are straight scripts). Add a blank line at the end of the file... Seriously. Yes, I'm really not shitting you. Cheers, -- Brett Parker
participants (4)
-
Brett Parker -
Jenny Hopkins -
Martin A. Brooks -
Srdjan Todorovic