Re: being able to get results of shell command
- From: Dominic Amann <dominic lbs ca>
- To: sawfish-list gnome org
- Subject: Re: being able to get results of shell command
- Date: Thu, 27 May 2004 08:16:56 -0400
Rohan Nicholls wrote:
I am trying to figure out how to find out if a program is already
running before starting it up. I start a number of programs from my
.sawfishrc and on a restart of sawfish I don't want to start them up
again.
Is there someway to tell if the new start is the result of a restart or
not?
Is there a way to get the results back from something like a call to:
ps -A|grep -i <process name>
Or a way to see the system processes as opposed to only the ones
controlled by sawfish.
I have been reading the process section of info, but have not completely
got my head around how to put this to practical use.
Thanks for any help.
rohan
You can use $? for the PID of the last executed foreground command, and
$! for the last background command, so something like
$ command &
$ command_pid=$!
will capture the PID of the command. If you save these to file, then you
can see whether the command is still running. There is a function in the
init scripts that works just like this on most systems.
--
Dominic Amann, Linux Based Solutions Ltd., <http://www.lbs.ca/>
18 Candlewood Cr, Toronto, ON M3J 1G8
Tel: (416) 638-8649 Fax: (416) 630-1584
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]