Added support for monitoring services with name other than yate.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6328 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
fbd39c5c20
commit
30ac2b3135
|
@ -4,7 +4,7 @@
|
||||||
# This file is part of the YATE Project http://YATE.null.ro
|
# This file is part of the YATE Project http://YATE.null.ro
|
||||||
#
|
#
|
||||||
# Yet Another Telephony Engine - a fully featured software PBX and IVR
|
# Yet Another Telephony Engine - a fully featured software PBX and IVR
|
||||||
# Copyright (C) 2010-2014 Null Team
|
# Copyright (C) 2010-2018 Null Team
|
||||||
#
|
#
|
||||||
# This software is distributed under multiple licenses;
|
# This software is distributed under multiple licenses;
|
||||||
# see the COPYING file in the main directory for licensing
|
# see the COPYING file in the main directory for licensing
|
||||||
|
@ -18,14 +18,34 @@
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
|
||||||
# Use: yatemon.sh [-p pid]
|
# Use: yatemon.sh [-n name|-p pid]
|
||||||
# Displays a history of Yate's memory and thread CPU usage
|
# Displays a history of Yate's memory and thread CPU usage
|
||||||
# You will need a very wide console
|
# You will need a very wide console
|
||||||
|
|
||||||
pid=`pidof yate 2>/dev/null`
|
case "X$1" in
|
||||||
|
X-p)
|
||||||
|
pid="$2"
|
||||||
|
;;
|
||||||
|
X-n)
|
||||||
|
pid=`pidof "$2" 2>/dev/null`
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
pid=`pidof yate 2>/dev/null`
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ "X$1" = "X-p" ]; then
|
if echo "$pid" | grep -q '^[0-9]\+ [0-9]\+$'; then
|
||||||
pid="$2"
|
p1="${pid%% *}"
|
||||||
|
p2="${pid##* }"
|
||||||
|
if [ "X"`ps -p "$p1" -o ppid= | sed 's/ //g'` = "X1" ]; then
|
||||||
|
if [ "X"`ps -p "$p2" -o ppid= | sed 's/ //g'` != "X1" ]; then
|
||||||
|
pid="$p2"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ "X"`ps -p "$p2" -o ppid= | sed 's/ //g'` = "X1" ]; then
|
||||||
|
pid="$p1"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! kill -0 "$pid" 2> /dev/null; then
|
if ! kill -0 "$pid" 2> /dev/null; then
|
||||||
|
|
Loading…
Reference in New Issue