Dave's Brain

Browse - programming tips - is that process alive

Date: 2008dec29
OS: Linux
Language: bash

Q.  How can I tell if given process is alive?

A.  Use the -p option of ps like this:

	MYPID=1234
	if ps -p $MYPID >/dev/null; then
		echo alive
	else
		echo not-alive
	fi

I read about this in Linux Journal.
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2010, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.