davis@pacific.mps.ohio-state.edu ("John E. Davis") (02/06/91)
Hi, I have a program running in the background that writes to the status line of my vt330. When I am in graphics mode on the terminal, the program which updates the status line wrecks havoc once a minute with the graphicsc display. So I would like to be able to start and stop the program at will. The program is not listed by the `jobs' command since I create a forked child process that exits as soon as the parent dies which effectively means that as soon as I logout the program dies. Anyway this is not the point; the point is that I cannot do `stop %3' or whatever since the shell is not aware of the child. So the bottom line is that csh job control will not work. 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'' . Finally to resume it I do kill -CONT `pid'. Is there an easier way??? How can I avoid getting the pid of the program via `ps -aux' or perhaps make the program smart enough not to update the status line (impossible, I think). Thanks, -- John bitnet: davis@ohstpy internet: davis@pacific.mps.ohio-state.edu
jerry@ora.com (Jerry Peek) (02/07/91)
davis@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@ora.com