Your Ad Here

IBM AIX/UNIX system storage administration ksh/perl scripting

Monday, March 09, 2009

Script to list process in current runq in AIX

The script also exclude the process created by the script itself.


#!/bin/ksh
myPID=$$
echo
echo "CMD PID Uptime CPU_time THCNT in_RunQ" | awk ' { printf ("%-10s %-10s %-15s %-10s %-10s %s",$1,$2,$3,$4,$5,$6"\n") }'
echo "--------------------------------------------------------------------"
ps -emo pid,tid,comm,etime,time,thcount,ppid,state | awk '$1 != "-" && $7 != MYPID { if (NB_THREAD != 0 ) { print PID"\t"NB_THREAD } ; PID=$3"\t"$1"\t"$4"\t"$5"\t"$6 ; NB_THREAD=0 } ; $NF=="R" { NB_THREAD=NB_THREAD + 1 }' MYPID="$myPID" | awk ' { printf ("%-10s %-10s %-15s %-10s %-10s %s",$1,$2,$3,$4,$5,$6"\n") }'
echo

3 comments:

jake george said...

Data Warehousing Online Training, ONLINE TRAINING – IT SUPPORT – CORPORATE TRAINING http://www.21cssindia.com/courses/data-warehousing-online-training-29.html The 21st Century Software Solutions of India offers one of the Largest conglomerations of Software Training, IT Support, Corporate Training institute in India - +919000444287 - +917386622889 - Visakhapatnam,Hyderabad Data Warehousing Online Training, Data Warehousing Training, Data Warehousing, Data Warehousing Online Training| Data Warehousing Training| Data Warehousing| "Courses at 21st Century Software Solutions
Talend Online Training -Hyperion Online Training - IBM Unica Online Training - Siteminder Online Training - SharePoint Online Training - Informatica Online Training - SalesForce Online Training - Many more… | Call Us +917386622889 - +919000444287 - contact@21cssindia.com
Visit: http://www.21cssindia.com/courses.html"

Nasreen Basu said...

excellent piece of information, I had come to know about your website from my friend kishore, pune,i have read atleast 8 posts of yours by now, and let me tell you, your site gives the best and the most interesting information. This is just the kind of information that i had been looking for, i'm already your rss reader now and i would regularly watch out for the new posts, once again hats off to you! Thanx a lot once again, Regards, obiee training in hyderabad,informatica training in hyderabad

Ramesh K said...

Thanks for sharing this information. You may also refer http://www.s4techno.com/aix-administration-training-online/ for more details.

Labels

Blog Archive

BlogCatalog