![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SCO Knew It Didn't Own Unix Copyrights, Court Ruling Suggests - DigitalJournal.com | iBot | UNIX and Linux RSS News | 0 | 08-14-2007 06:30 AM |
| Script doesn't work, but commands inside work | cheongww | UNIX for Dummies Questions & Answers | 2 | 11-14-2006 06:52 PM |
| Command doesn't work under cron ? | bigjohn-nj | Shell Programming and Scripting | 4 | 01-20-2006 12:38 PM |
| ncopy doesn't work from cron | Selma | UNIX for Dummies Questions & Answers | 2 | 01-20-2005 05:28 AM |
| Simple cron job won't work | coregan | UNIX for Dummies Questions & Answers | 4 | 01-20-2004 01:22 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
script didn;t work in cron !!! @_@
Hi all,
I am writing a script to monitor some processes existence in the system. It works perfectly by running the script manually in commend line. However, when I put it under cron to run it failed. Everything time when the variable is null in the if statment. it failed and quitted. Here is part of my script. **** NTP_STATUS=`ps -ef | grep xntp | grep -v grep` if [ -z $NTP_STATUS ] then echo "WARNING - NTP daemon is not running" else echo "MESSAGE - NTP daemon is running" fi **** Therefore, when the variable NTP_STATUS is null, the script dropped out and quitted. The weird thing is that it works fine when I run an script manually, but fails in cron.... please help guys. Thanks in advance. |
| Forum Sponsor | ||
|
|
|
|||
|
just change the following
i hope there is only one daemon process that you are looking for... then NTP_STATUS=`ps -ef | grep xntp | grep -v grep|wc -l` if [ $NTP_STATUS < 1 ] then echo "WARNING - NTP daemon is not running" else echo "MESSAGE - NTP daemon is running" fi I hope this solves the problem. Cheers Nimish |