Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ps command to check for long running processes on AIX

Status
Not open for further replies.

MICKKEY

Programmer
Dec 11, 2003
2
CA
Hi All

This is my first posting on tek-tip. Ok here's the problem
I'd like check for long running processes using the ps command but I'm not sure if I'm attacking this the right way or should I use Perl instead?

script:
logdir=/usr/local/logs
lg=30:00 test="`ps aux|grep [P]SAPPSRV | awk '{print $10}'`"
for i in $test do
if [[ $test -gt $lg ]]
then
echo "There is a long process"
else
echo "NO LONG RUNNING PROCESS"
fi
done


Any help would be great
thanks
James
 
the test condition won't work with a colon : in it
so change the following -
lg=3000
test="`ps aux|grep APPSRV | awk '{print $10}'`" |sed 's/://g'`


the sed will remove the : and you'll have integers for comparison.

Dickie Bird (:)-)))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top