|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
ps -ef
Hi,
I need find some server is running or nor, if not I have to send a mail, if I use ps -ef | grep buyerserver1 I am getting pid etc etc... I want validate with boolean value.. and send the mail.. how to do... |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
I use this:
the status to get the boolean expression with pgrep. In your script pgrep dhcpd > /dev/null if ( $status = 0 ) then echo "dhcpd is running" else echo "it is not running" fi |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
pgrep is a GNU linux utility - if you do not have it then use Code:
ps -ef | grep -q dhcpd if [ $? -eq 0 ] ; then echo "dhcpd running" else echo "dhcpd not running" fi |
|
#4
|
|||
|
|||
|
Quote:
ps -ef | grep <user> | grep -q dhcpd |
| Sponsored Links | |
|
|
#5
|
||||
|
||||
|
Quote:
Code:
ps -fu <user> | grep -q dhcpd |
| Sponsored Links | ||
|