![]() |
|
|
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 |
| Check FTP Status | april | Shell Programming and Scripting | 2 | 05-06-2009 09:04 AM |
| check exit status - Expect Script | iamcool | Shell Programming and Scripting | 1 | 01-02-2008 09:07 AM |
| how to check exit status in awk script | epall | UNIX for Dummies Questions & Answers | 1 | 06-24-2006 08:27 PM |
| check the status and send an email with status | isingh786 | Shell Programming and Scripting | 3 | 12-29-2005 07:22 PM |
| Ftp Status Check | acheepi | Shell Programming and Scripting | 4 | 09-08-2005 04:23 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
i'm just learning scripting, and have been banging my head against this
I want to check if my WAS6 java process is running and if so..echo me a messages. If not then echo me a different messages the problem i have is I dont know how to represent a NULL return value. If i grep for a was6 java pid, the $? is always '0'...no matter if a PID came back or not. any idea on how to write/rewrite this?? PID=`/usr/ucb/ps -auxwww |grep -i [s]erver1 |grep -v grep | awk '{print $2}'` if [ $? -eq ] ; then ( i have also tried `if [ $PID -eq ] ; then) echo " WAS6 is down,please restart" else echo " WAS6 is running, no action needed" fi -------------------------------------------------------------------- In addition, i've tried this variation below, which seems like works ..but i always get the error when executing.. # cat test.ksh #!/bin/ksh # # Check to see if URLs respond in a given time period # BASE_DIR="/local/apps/adminutils" WGET="$BASE_DIR/bin/wget" DAT_FILE="$BASE_DIR/etc/url_check.dat" MAIL_LIST="user@net.net" PID=`/usr/ucb/ps -auxwww |grep -i [s]erver1 |grep -v grep | awk '{print $2}'` if [ $PID = ] ; then echo " WAS6 is down,please restart" else echo " WAS6 is running, no action needed" fi # ./test.ksh ./test.ksh[11]: test: argument expected WAS6 is running, no action needed # ~ |
|
||||
|
thank you so very much... I HAVE search countless books and searched the entire library on www.books24x7.com and safair.orielly.com and none of then could tell me this...
i'll be a regular on this forum for sure...tks again...i'll try this method out |
|
||||
|
btw, do any of you guys know where I can get a list of these kind of directives and what they do?
Im trying to get better at shell scripting....but its like trying to write a letter without knowing the dictionary.... -z -eq -$? etc..etc...etc... |
|
|||||
|
You can read the following document :KornShell 88 Manual Page
You will find ather links on the page KornShell Documentation Jean-Pierre. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|