Results 1 to 2 of 2
I just created a script that when run, it will output the ff:
[root@smtp01 intigrix]# /var/intigrix/rate.sh > /var/intigrix/rates.txt
[root@smtp01 intigrix]# cat rates.txt
0,,99.08,0,OK
99.08 is a variable while the rest ...
- 03-12-2009 #1Linux Newbie
- Join Date
- Mar 2006
- Posts
- 101
no values when script runnign in crontab
I just created a script that when run, it will output the ff:
[root@smtp01 intigrix]# /var/intigrix/rate.sh > /var/intigrix/rates.txt
[root@smtp01 intigrix]# cat rates.txt
0,,99.08,0,OK
99.08 is a variable while the rest including 0 is a fixed values.
The problem is when I already put it in crontab, it only display the ff:
0,,,0,OK
The 99.08 is missing. My entry in crontab is the ff:
*/1 * * * * /var/intigrix/rate.sh > /var/intigrix/rates.txt
Is there a limitation in cron daemon? Just remember that when I do the commands in shell, it is ok but when I put it in cron, it has no values.
- 03-12-2009 #2Linux Newbie
- Join Date
- Mar 2009
- Posts
- 228
A common reason why a script works when run interactive but doesn't when run by crond is that cron doesn't 1st execute your profile script like .bash_profile. So variables like PATH aren't defined as they normally are.
The thing to do is run script in cron in verify mode to find the problem.
*/1 * * * * sh -vx /var/intigrix/rate.sh > /var/intigrix/rates.txt 2>&1


Reply With Quote