Module: sip-router
Branch: master
Commit: 65247ededd6776d96cafab9ddd934136171feaf7
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=65247ed…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri May 4 16:13:06 2012 +0200
kamctl: avoid including .ctlbase many times
- resulted in duplicated help output
- added shortcuts for uptime and stats
- aliased mi to fifo command
---
utils/kamctl/kamctl | 12 +++++++++++-
utils/kamctl/kamctl.ctlbase | 26 ++++++++++++++++++++++++++
utils/kamctl/kamctl.fifo | 5 +++--
3 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl
index 7fe1c81..5e0d7a7 100755
--- a/utils/kamctl/kamctl
+++ b/utils/kamctl/kamctl
@@ -2405,7 +2405,7 @@ case $1 in
trusted "$@"
;;
- fifo|unixsock|ser_mi|sercmd_mi|sercmdmi)
+ fifo|mi|unixsock|ser_mi|sercmd_mi|sercmdmi)
require_ctlengine
shift
$CTLCMD "$@"
@@ -2469,6 +2469,16 @@ case $1 in
$CTLCMD ps
;;
+ uptime)
+ require_ctlengine
+ $CTLCMD uptime
+ ;;
+
+ stats)
+ require_ctlengine
+ $CTLCMD get_statistics all
+ ;;
+
restart)
openser_stop
sleep 2
diff --git a/utils/kamctl/kamctl.ctlbase b/utils/kamctl/kamctl.ctlbase
index 9042ec2..1148cbb 100644
--- a/utils/kamctl/kamctl.ctlbase
+++ b/utils/kamctl/kamctl.ctlbase
@@ -5,6 +5,10 @@
#
#===================================================================
+[ "${IMPCTLBASE}" = "yes" ] && return
+
+export IMPCTLBASE="yes"
+
##### ----------------------------------------------- #####
### common variables and functions for CTL engines
#
@@ -72,3 +76,25 @@ EOF
}
USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_usrloc"
+usage_ctlcommon() {
+ echo
+ mecho " -- command 'ps' - print details about running processes"
+ echo
+cat <<EOF
+ ps ................................. details about running processes
+EOF
+ echo
+ mecho " -- command 'uptime' - print uptime details"
+ echo
+cat <<EOF
+ uptime ............................. print start time end elapsed seconds
+EOF
+ echo
+ mecho " -- command 'stats' - print internal statistics"
+ echo
+cat <<EOF
+ stats .............................. dump all internall statistics
+EOF
+}
+USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_ctlcommon"
+
diff --git a/utils/kamctl/kamctl.fifo b/utils/kamctl/kamctl.fifo
index 59812db..4c734cd 100644
--- a/utils/kamctl/kamctl.fifo
+++ b/utils/kamctl/kamctl.fifo
@@ -33,10 +33,11 @@ fi
#
usage_fifo() {
echo
- mecho " -- command 'fifo'"
+ mecho " -- command 'mi' - send raw MI commands"
echo
cat <<EOF
- fifo ............................... send raw FIFO command
+ mi ................................. send raw MI command
+ fifo ............................... send raw FIFO (MI) command
EOF
}
USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_fifo"