sometimes I run a script or program which takes a while to run (like compiling something). Half through, I realise that I would like to run a command afterwards (say, reboot or beep). Had I realised earlier, I could have done
cmd1 ; reboot
But if it's already running, is there anyway to tag on subsequent commands? I mean, it is possible to pause it with a CTRL-Z in the bash shell.
If not, I may try writing an app that I can run in the CTRL-Z space, like checkApp cmd1 -[cmd2 cmd3] & ( ; fg 1), which greps ps -ef to see if cmd1 is still running, and if not run cmd2, cmd3 etc. Perhaps one exists though?
Does something like this already exist, or is there a way of tagging on subsequent commands?
Thank you for your time.
by Jojo http://www.votelinux.com/tips/144-Re...ram-is-running
Here is a little bash script which will monitor the status of any process. Just call it with the processname (or a part of it) and it will loop endlessly unless the given process has quit.
This is very useful to monitor the status of daemons on a server
while ps ax | grep -v -e grep -e [scriptFileName] | grep -q $1 ; do
echo "Programm $1 running"