On Sun, Jul 24, 2016 at 06:39:19PM +0100, ian gilmour wrote:
> The following bash 1-liner may be useful...
> 
> while true; do top -Hbc -p `pgrep asterisk` -n 1 && asterisk -rx "core show
> threads"; sleep 1; done

Just for the kicks:

ps --no-headers -L -o lwp,cp --sort lwp `pidof asterisk` \
| join -1 1 -2 2 - <(asterisk -rx 'core show threads' | sort -k2) \
| sort -n -k 2

Notes:
1. Bashism. <(...) requires bash.
2. Join counts on a non-numeric sort. Maybe there's an extrs sort needed
   for ps, as I guess it sorts numerically.
3. I tried puting this all in watch: watch -n1 -d '...' or 
   watch -n1 -d bash -c "...", but I got an error message:
   "sh: 1: Syntax error: "(" unexpected"

(sh? shouldn't it be bash?)

But at this point I have already exceeded the allocated time slot.

-- 
               Tzafrir Cohen
icq#16849755              jabber:[email protected]
+972-50-7952406           mailto:[email protected]
http://www.xorcom.com

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to