![]() |
|
|
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 |
| one question for bash shell script | zx1106 | Shell Programming and Scripting | 9 | 03-10-2008 12:40 AM |
| Bash scripting question re: newlines | retrovertigo | Shell Programming and Scripting | 4 | 07-06-2007 01:44 PM |
| quick newbie bash question | redsand9009 | Shell Programming and Scripting | 4 | 01-25-2007 03:44 AM |
| awk / bash globbing question | franzke | Shell Programming and Scripting | 3 | 07-15-2005 12:55 AM |
| BASH shell script question | ewarmour | Shell Programming and Scripting | 3 | 05-24-2002 06:10 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
bash question
Hi Guys,
I found this script for monitoring the status of a services: for i in syslogd cron; do if [ `ps -eo comm | grep -v grep | grep -c ^$i` -gt 0 ] && [ `ps -eo comm,s|grep -v grep|grep ^$i|awk '{print $2}'|sort -u` = "A" ]; then printf "%-8s" "$i";printf " is alive=A\n" else printf "%-8s" "$i";printf " is not alive\n" fi The script is working fine except if either syslogd or cron will have a defunct on the memory. It will have an error like this: /usr/local/bin/checkserver.sh: line 9: [: too many arguments syslogd is not alive But of course, syslogd is running if I check with ps -ef | grep syslogd: [itik@north001 ~]$ ps -ef|grep syslogd root 1234 1 0 May04 ? 00:11:42/usr/sbin/syslogd root 18555 5525 0 May04 ? 00:00:00 [syslogd] <defunct> itik 22417 19840 0 13:23 pts/1 00:00:00 grep syslogd Without error the output is like this: cron is alive=A syslogd is alive=A Can someone please let me know where to change the error? Thank you in advance. Best Regards, itik |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|