[Techtalk] Shell script to send user defined signal to a process
Stratis Aftousmis
stratus at ccsi.com
Fri Sep 19 09:36:44 EST 2003
>
> Hi,
>
> I want my shell script to send a user defined signal to a process. I
> know that using pidof <processname> I can get the pid of the process
> and using kill <sig #> <pid> i can send the signal to the process
> whose id is eq to <pid>. How can I do this in a shell script.
>
> The foll does not work -
> #!/bin/sh
> PD=pidof test
> kill 41 $PD
>
> This might be a very simple thing to do but I am beginner at shell
> scripting. Would appreciate it if someone could help me.
>
> Thanks,
> Ruchika
> _________________________________________________________________
>
> [1]Need more e-mail storage? Get 10MB with Hotmail Extra Storage.
>
> References
>
> 1. http://g.msn.com/8HMBENUS/2734??PS=
> _______________________________________________
> Techtalk mailing list
> Techtalk at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/techtalk
Hi, try this:
#!/bin/bash
test && kill $! #'!' expand's the the last command run, but if i'm not
exit 1 #mistaken it has to be on the same line as the command is
#run, which is why i used the '&&' (and)
But if you don't understand that, there alway's "The advanced Bash Scripting
Guide"
http://www.tldp.org/LDP/abs/html/
I recommend that, also try the primer located in
'/usr/doc/Linux-HOWTOs'(if installed):
Bash-Prog-Intro-HOWTO
Hope that help's.
--
www.ccsi.com/~stratus
stratus at ccsi.com
"What is complex to one, is not to another."
~In the beginning there was the command line: by Neal Stephenson
More information about the Techtalk
mailing list