View Full Version : How to find out if a process is suspended or not?
petey
09-03-2002, 04:15 AM
how can i find out in the terminal if a process is suspended or not?
TIA
mervTormel
09-03-2002, 08:37 AM
hmm, % man ps says a stopped process will have a T in the status, but i can't get it to show for stopped jobs {sigh}
could you explain what you mean by "suspended"? and is there is a specific issue you're trying to resolve?
petey
09-03-2002, 09:35 AM
i'm tired of MS Word sucking up 10% - 15% of my CPU when it's in the background.
so i'm trying to engineer a way to suspend/resume Word using the kill -STOP and kill -CONT commands.
but it would be easier to automate if i could find the current status of the app.
mervTormel
09-03-2002, 09:56 AM
i see. well, since ps doesn't seem to reflect the T in the job state, you'll have to resort to some sentinel turd toggle switch. something like...
turd=~/.word.stopped
pid=# get the pid of app
if [ ! -f $turd ]; then kill -STOP $pid; touch $turd; fi
if [ -f $turd ]; then kill -CONT $pid; rm $turd; fi
try that and let us know
mervTormel
09-03-2002, 11:46 AM
a bit more refined...
#!/bin/sh
# file: kork - toggle MS word thru STOP and CONT
#set -x
turd=~/.word.stopped
wpid=`ps wwax | egrep -i '[m]icrosoft word -psn' | cut -b 1-5`
# echo $wpid; exit
if [ ! $wpid ]; then
echo no me gusta; exit;
fi
if [ ! -f $turd ]; then
kill -STOP $wpid; touch $turd; echo "word kork'd";
else
kill -CONT $wpid; rm $turd; echo "unkork'd word";
fi
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.