The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


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 !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
script to monitor process running on server and posting a mail if any process is dead pradeepmacha Shell Programming and Scripting 12 10-17-2008 12:08 AM
Event-Driven Business Process Management and the Example of the Deutsche Post AG iBot Complex Event Processing RSS News 0 03-07-2008 10:30 PM
Business process management: Avoiding the pitfalls iBot Complex Event Processing RSS News 0 02-13-2008 05:30 AM
how to start a process and make it sleep for 5 mins and then kill that process shrao Shell Programming and Scripting 6 03-27-2007 09:54 AM
"Process management" question alan UNIX for Dummies Questions & Answers 1 01-12-2004 08:11 PM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-13-2000
Registered User
 

Join Date: Nov 2000
Posts: 1
Exclamation

Hi!

I desperately need some help here...
I need to write a shellscript that lists all running processes (as in ps -ef), search the list it gets for occurances of a certain process, if found do nothing if not found start it again.
Anyone feel up to it?

/G
Forum Sponsor
  #2  
Old 11-13-2000
PxT's Avatar
PxT PxT is offline
Registered User
 

Join Date: Oct 2000
Location: Sacramento, CA
Posts: 909
Try something like:

Code:
#!/bin/ksh

ps -ef | grep [f]oo
if [ $? -eq 1 ]
then
	echo Process not running.
	# Restart process here
fi

Replace 'foo' with whatever your process name is. The
[ ] brackets around the first letter will stop grep from matching on itself.

HTH
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:00 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0