Re: Check for Process
2001-10-11 18:14:56
Or the shorter form:
ps -ef| egrep '(dsm)serv' | wc -l
The (dsm)serv regular expression matches the "dsmserv" string in the ps entry
for dsmserv, but not the "(dsm)serv" string in the ps entry for egrep.
Either way, egrep or grep|grep -v grep is better than the plain grep | wc -l,
since grep doesn't always match itself (one of my systems it's about an 80% hit
rate; it depends on the number of processors, system load, etc.)
Scotty
--
Scotty Logan <swl AT stanford DOT edu>
Scotty Logan <swl AT stanford DOT edu>
ITSS-CSS http://www.stanford.edu/group/itss/css/
> -----Original Message-----
> From: ADSM: Dist Stor Manager [mailto:ADSM-L AT VM.MARIST DOT EDU]On
> Behalf Of
> Bill Maloney
> Sent: Thursday, October 11, 2001 12:21
> To: ADSM-L AT VM.MARIST DOT EDU
> Subject: Re: Check for Process
>
>
> FYI..
>
> To weed out the grep process:
>
> ps -eaf | grep dsmserv | grep -v grep | wc -l
>
>
>
> -----Original Message-----
> From: Charles Anderson
> Sent: Thu 10/11/2001 2:59 PM
> To: ADSM-L AT VM.MARIST DOT EDU
> Cc:
> Subject: Re: Check for Process
>
>
>
> Geoffrey,
>
> here ya go in bash ( I'm afraid I'm NT illiterate, so I dunno
> how much help this will be )
> -Ed Anderson
>
> #!/usr/local/bin/bash
> # BEGIN /root/bin/runTSMSERVyoubastard.bash
> #===============
> # Check for dsmserv running on solaris / True SysV
> #===============
>
> DATE=`date`
> PATHTODSMSERV="/opt/tivoli/tsm/server/bin/dsmserv"
> ISRUNNING=`ps -aef | grep dsmserv | wc -l`
> # Should be 2, one for the real process and one for the "grep
> dsmserv" process
>
> if ( "$ISRUNNING == "2" ); then
> exit
> else
> nohup $PATHTODSMSERV
> mail -s "TSM SERVER WAS RESTARTED ON $DATE"
> your-address AT your.domain DOT com [email protected]
> fi
>
> #END
>
> add this to your crontab for the root user
> 1 16-7 * * * /root/bin/runTSMSERVyoubastard.bash
>
> short sweet and to the point,
> ed
>
>
> >>> GEOFFREY.L.GILL AT SAIC DOT COM 10/11/01 01:47PM >>>
> I'd like to know if anyone has a script that will do the
> following. Cron
> would check once an hour from 4PM to 7 AM and see if the TSM
> server is up
> and running. If not to restart it. I had a problem last night
> and the
> operators didn't check backups for 6 hours and most were missed
> because TSM
> crashed.
>
> I'm sure this is easy to do, but my brain is mush from migrating
> TSM to a
> different production server and upgrading to 4.2.1. After the
> upgrade it
> crashed so most backups were missed. I can't erly on operations
> to check
> backups, even though they're supposed to.
>
> Geoff Gill
> TSM Administrator
> NT Systems Support Engineer
> SAIC
> E-Mail: gillg AT saic DOT com
> Phone: (858) 826-4062
> Pager: (888) 997-9614
>
>
>
|
|
|