FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 12-23-2010, 05:57 AM
Zhang Weiwu
 
Default how to get pid when I start the process

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:

zhangweiwu@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 S grep mule
zhangweiwu@mesopotamia:~$ kill 13595

Note that I should always kill the least-numbered process, I tried
otherwise and always end up in trouble.

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?

Best. & Thanks in advance!


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4D12F2C8.9070606@realss.com">http://lists.debian.org/4D12F2C8.9070606@realss.com
 

Thread Tools




All times are GMT. The time now is 02:45 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org