M
M
Maxim Chornopolsky2014-10-17 11:35:12
linux
Maxim Chornopolsky, 2014-10-17 11:35:12

Why is the script not running from cron?

#!/bin/sh
t=`/usr/bin/curl http://24temp.ru/android/2014-24temp.php | /usr/bin/tr -d {t\"ph, | /usr/bin/awk -F":" '{ print $2 }'`
echo "$t" >> ~/t.txt

Here is such a miracle code that works great in the console, when manually calling the script. But it doesn't work when run through cron. In general, no reaction was achieved. logs only
Oct 17 16:31:02 screencapture /USR/SBIN/CRON[14551]: (chemax) CMD (root sh /home/chemax/getdata/getdata2.sh)
or
Oct 17 16:33:01 screencapture /USR /SBIN/CRON[14970]: (chemax) CMD (chemax sh home/chemax/getdata/getdata.sh)
Depends on the version of the script I'm trying to run.
How can I make cron chew it? I did 2>/dev/null both in the script itself and in the cron command. Effect 0.
Tried to shove logger script - does not display anything. I set the rights to the script 777 and +x. What else to do - I have no idea.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir, 2014-10-17
@Voiddancer

from under the root
or user chemax
the following line
* * * * * /home/chemax/getdata/getdata.sh

R
Roman Bazalevsky, 2014-11-02
@rvbglas

Write the full path to the script, and in the script - the full path to everything called.
PATH in the cron environment can easily be different from the PATH in the user session environment.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question