suspend process question
Jerry Peek
jerry at ora.com
Thu Feb 7 03:39:17 AEST 1991
davis at pacific.mps.ohio-state.edu (John E. Davis) writes:
> I have a program running in the background ...
> I would like to be able to start and stop the program at will... I
> cannot do `stop %3' or whatever since the shell is not aware of the child...
> What I currently do is to do `ps -aux | grep sline' (sline is the name of
> the program) to get the pid, `pid', then do `kill -STOP `pid'' ...
> Is there an easier way??? How can I avoid getting the pid of the program
> via `ps -aux' ...
A while ago, I used a program called sysline(1) that updated the status
line. It had a command line option that meant "write your PID to standard
output." You could grab that number in a file at startup:
# start sysline program; store its PID in "$HOME/.sysline.pid":
sysline -D -l -p -i > ~/.sysline.pid
Then cat the file when you needed to send a signal. I think I used an alias:
alias usysline 'blah blah; kill -ALRM `cat ~/.sysline.pid`'
I also had another setup that worked on multiple terminals at once.
It stored the PID in an environment variable, I think. But you get the idea.
--Jerry Peek, O'Reilly & Associates Inc., jerry at ora.com
More information about the Comp.unix.questions
mailing list