![]() |
|
|
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 |
| Identifying and grouping OS processes and APP processes | wilsonee | SUN Solaris | 2 | 09-30-2008 10:26 AM |
| Monitoring Processes - Killing hung processes | ukndoit | UNIX for Advanced & Expert Users | 4 | 01-17-2008 04:30 AM |
| Help with counting files please | gerard1 | Shell Programming and Scripting | 6 | 09-25-2006 02:37 PM |
| counting characters | plelie2 | Shell Programming and Scripting | 6 | 02-25-2003 01:38 PM |
| Counting LOC in C | amatsaka | High Level Programming | 1 | 06-04-2002 04:18 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Counting Processes
I have a simple script that I want to notify me whenever there are anything other than one instance of a particular process running. I've always used the script: Code:
DPID_DW=$(ps -ef | grep [d][w] | wc -l)
if [ "${DPID_DW}" -eq 0 ]
then
echo "The data warehouse manager for DB is down"
elif [ "${DPID_DW}" -gt 1 ]
then
echo "More than one instance of the DW Manager is running"
fi
,,,the problem is that the process is more than a single line. It looks like: Code:
ps -ef | grep [d][w] genret 156098 1 0 Mar 19 - 167:25 /prod/jre_1.3.1/sh/java -Dprgi d=DWManager -Xms1m -Xmx1024m -Djava.security.policy=/gers/genret/.java.policy -D xml.catalog.files=/gers/catalog/catalog -cp /gers/genret/opt/path/gerscs.jar:/ge rs/genret/opt/path/gersdw.jar:/gers/genret/jdbc/lib/classes12.zip:/gers/genret/m enu/pub/sbin:/gers/genret/menu/pub/bin:/gers/genret/menu/pub/mac:/gers/genret/me nu/adm/sbin:/gers/genret/menu/adm/bin:/gers/genret/menu/adm/mac:/gers/genret/men u/sup/bin:/gers/genret/menu/sup/mac:/gers/genret/custom:/gers/genret/fix:/gers/g enret/src_rev/fix:/gers/genret/opt/path:/gers/genret/bin:/g/bin:/usr/bin:/etc:/u sr/sbin:/usr/ucb:/sbin -DVERBOSE=n com.gers.dw.DWManager |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|