View Single Post
Old 12-20-2002, 12:05 PM   #9 (permalink)
technobard
Centurion Nova Prime
 
technobard's Avatar
 
Join Date: May 2002
Location: Oak Park, IL (USA)
Posts: 285
technobard is on a distinguished road
Hey, sde.

I don't know about the screen thing, but you can put whatever you want in the grep. Another option is to start your jobs in the background:
(./hlds_run -game cstrike -port 27015 &)
...

Immediately after putting a job in the background, the process id is available in the shell variable $!
So you can do:

echo $! > hds_run1.pid

Your kill script would then do something like:

mykill hds_run1 ( or hds_run2, etc.)

mykill would look for the file name.pid, then do something like:
kill -9 `cat name.pid`

This should solve the problem of accidently killing other processes. If you include enough in grep to make it unique, you can accomplish the same thing, but the name.pid solution is probably a more generic solution.
technobard is offline   Reply With Quote