![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| 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 10:30 AM |
| Script doesn't work, but commands inside work | cheongww | UNIX for Dummies Questions & Answers | 2 | 11-14-2006 10:52 PM |
| Command doesn't work under cron ? | bigjohn-nj | Shell Programming and Scripting | 4 | 01-20-2006 04:38 PM |
| ncopy doesn't work from cron | Selma | UNIX for Dummies Questions & Answers | 2 | 01-20-2005 09:28 AM |
| Simple cron job won't work | coregan | UNIX for Dummies Questions & Answers | 4 | 01-20-2004 05:22 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | 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. |
|
||||
|
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 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|