[SLVED] Re: how to get pid when I start the process

2010-12-25 Thread Zhang Weiwu
Several people offered advise. The trick is really how to locate and kill the parent process, because I have tried otherwise and failed. Following suggestion from Bob Proulx, killing all processes would ends up with corrupted temporary files in my case. Bob wrote in detail explanation of how thinks

Re: how to get pid when I start the process

2010-12-24 Thread Bob Proulx
Richard Hector wrote: > $$ is the pid of the current shell. > > $! is the pid of the most recent background process, so you could do: > > amuled & echo $! > amuled.pid > ... > kill `cat amuled.pid` Since presumabely amuled forks itself into the background then putting it into the background at l

Re: how to get pid when I start the process

2010-12-23 Thread Richard Hector
On Thu, 2010-12-23 at 16:29 +, Bill Dennen wrote: > On Thu, 23 Dec 2010 08:30:02 +0100, Zhang Weiwu scribbled: > > > Hello. I usually start amuled and kill it after a few hours, I do such > > thing once a day. Usually I do it like this: > > > > In one console: > > $ amuled > > > > In another

Re: how to get pid when I start the process

2010-12-23 Thread Bill Dennen
On Thu, 23 Dec 2010 08:30:02 +0100, Zhang Weiwu scribbled: > Hello. I usually start amuled and kill it after a few hours, I do such > thing once a day. Usually I do it like this: > > In one console: > $ amuled > > In another: > > zhangwe...@mesopotamia:~$ ps ax | grep mule 13595 zhangwei 14080

Re: how to get pid when I start the process

2010-12-23 Thread John Hasler
Zhang Weiwu writes: > Question is, how do I script-lize this? The only difficulty is to get > the pid in script. I could use an one-liner awk script to analyses the > output of ps, but that sounds overkill. Is there a better way? man killall man pidof -- John Hasler -- To UNSUBSCRIBE, email to

Re: how to get pid when I start the process

2010-12-23 Thread Alex Mestiashvili
Zhang Weiwu wrote: Hello. I usually start amuled and kill it after a few hours, I do such thing once a day. Usually I do it like this: In one console: $ amuled In another: zhangwe...@mesopotamia:~$ ps ax | grep mule 13595 zhangwei 14080 R N amuled 13598 zhangwei 14080 S N amuled 13600 zhangw

Re: how to get pid when I start the process

2010-12-23 Thread Chris Davies
Zhang Weiwu wrote: > zhangwe...@mesopotamia:~$ ps ax | grep mule > 13595 zhangwei 14080 R N amuled > 13598 zhangwei 14080 S N amuled > 13600 zhangwei 14080 S N amuled > 13603 zhangwei 14080 S N amuled > 13612 zhangwei 1352 Sgrep mule > zhangwe...@mesopotamia:~$ kill 13595 > Note that I s

Re: how to get pid when I start the process

2010-12-22 Thread Bob Proulx
Zhang Weiwu wrote: > zhangwe...@mesopotamia:~$ ps ax | grep mule > 13595 zhangwei 14080 R N amuled > 13598 zhangwei 14080 S N amuled > 13600 zhangwei 14080 S N amuled > 13603 zhangwei 14080 S N amuled > 13612 zhangwei 1352 Sgrep mule > zhangwe...@mesopotamia:~$ kill 13595 > > Note that I

how to get pid when I start the process

2010-12-22 Thread Zhang Weiwu
Hello. I usually start amuled and kill it after a few hours, I do such thing once a day. Usually I do it like this: In one console: $ amuled In another: zhangwe...@mesopotamia:~$ ps ax | grep mule 13595 zhangwei 14080 R N amuled 13598 zhangwei 14080 S N amuled 13600 zhangwei 14080 S N amuled