[aclug-L] Re: script to kill
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
glandix@xxxxxxxxxxxxxx wrote:
>
> is there a way to grep out the pid of a process via bash script?
> basically what i want to do is write a script to start a program, BUT
> at the beginning of the script kill any current processes of that
> program. is there a simple way to do this? is there a program or
> script that will return only the PID of a process when given the name
> of the program?
$ ps -e | awk '$4==PROG{print $1}' PROG=init -
Just replace "init" with whatever program name you want. Note that you
may get multiple answers. If the intent is to run kill, this is fine:
$ kill -15 `ps -e | awk '$4==PROG{print $1}' PROG=killme -`
> jesse
> --
> <<<Linux lloydix 2.2.14 #1 Sat Jan 22 04:29:13 CST 2000 i586 unknown>>>
>
> Oh my God! Space aliens! Don't eat me, I have a wife and kids! Eat them.
>
> -- Homer Simpson
> Treehouse of Horror VII
>
> -- This is the discussion@xxxxxxxxx list. To unsubscribe,
> visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
--
/*
* Tom Hull * thull@xxxxxxxxxxx * http://www.ocston.org/~thull/
*/
-- This is the discussion@xxxxxxxxx list. To unsubscribe,
visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
- [aclug-L] script to kill, glandix, 2000/03/21
- [aclug-L] Re: script to kill,
Tom Hull <=
- [aclug-L] Re: script to kill, Tom Hull, 2000/03/22
- [aclug-L] Re: script to kill, Carl D Cravens, 2000/03/22
- [aclug-L] Re: script to kill, Tom Hull, 2000/03/22
- [aclug-L] Re: script to kill, Carl D Cravens, 2000/03/22
[aclug-L] Re: script to kill, John Goerzen, 2000/03/22
|
|