[PATCH] kannel-init.diff - enable /etc/init.d/kannel status
Konstantin Vayner <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Simple patch to the init script(s) (somehow, i found multiple different versions) to allow status command (using admin http) assumes that bearerbox is running on localhost, read admin-port and admin-password from core group config Regards, Konstantin
kannel-init.diff
(application/octet-stream, 3.9 KB)
Index: debian/kannel-cvs.init
===================================================================
--- debian/kannel-cvs.init (revision 4888)
+++ debian/kannel-cvs.init (working copy)
@@ -9,7 +9,8 @@
BOXPATH=/usr/sbin
PIDFILES=/var/run/kannel
-CONF=/etc/kannel/kannel.conf
+CONFDIR=/etc/kannel
+CONF=$CONFDIR/kannel.conf
PATH=$BOXPATH:$PATH
@@ -80,6 +81,14 @@
echo "."
;;
+ status)
+ CORE_CONF=$(grep -r 'group[[:space:]]*=[[:space:]]*core' $CONFDIR | cut -d: -f1)
+ ADMIN_PORT=$(grep '^admin-port' $CORE_CONF | sed "s/.*=[[:space:]]*//")
+ ADMIN_PASS=$(grep '^admin-password' $CORE_CONF | sed "s/.*=[[:space:]]*//")
+ STATUS_URL="http://127.0.0.1:${ADMIN_PORT}/status.txt?password=${ADMIN_PASS}"
+ lynx -source $STATUS_URL
+ ;;
+
reload)
# We don't have support for this yet.
exit 1
@@ -92,7 +101,7 @@
;;
*)
- echo "Usage: $0 {start|stop|restart|force-reload}"
+ echo "Usage: $0 {start|stop|status|restart|force-reload}"
exit 1
esac
Index: debian/kannel-devel.init
===================================================================
--- debian/kannel-devel.init (revision 4888)
+++ debian/kannel-devel.init (working copy)
@@ -9,7 +9,8 @@
BOXPATH=/usr/sbin
PIDFILES=/var/run/kannel
-CONF=/etc/kannel/kannel.conf
+CONFDIR=/etc/kannel
+CONF=$CONFDIR/kannel.conf
PATH=$BOXPATH:$PATH
@@ -80,6 +81,14 @@
echo "."
;;
+ status)
+ CORE_CONF=$(grep -r 'group[[:space:]]*=[[:space:]]*core' $CONFDIR | cut -d: -f1)
+ ADMIN_PORT=$(grep '^admin-port' $CORE_CONF | sed "s/.*=[[:space:]]*//")
+ ADMIN_PASS=$(grep '^admin-password' $CORE_CONF | sed "s/.*=[[:space:]]*//")
+ STATUS_URL="http://127.0.0.1:${ADMIN_PORT}/status.txt?password=${ADMIN_PASS}"
+ lynx -source $STATUS_URL
+ ;;
+
reload)
# We don't have support for this yet.
exit 1
@@ -92,7 +101,7 @@
;;
*)
- echo "Usage: $0 {start|stop|restart|force-reload}"
+ echo "Usage: $0 {start|stop|status|restart|force-reload}"
exit 1
esac
Index: debian/kannel.init
===================================================================
--- debian/kannel.init (revision 4888)
+++ debian/kannel.init (working copy)
@@ -9,7 +9,8 @@
BOXPATH=/usr/sbin
PIDFILES=/var/run/kannel
-CONF=/etc/kannel/kannel.conf
+CONFDIR=/etc/kannel
+CONF=$CONFDIR/kannel.conf
PATH=$BOXPATH:$PATH
@@ -71,6 +72,14 @@
echo "."
;;
+ status)
+ CORE_CONF=$(grep -r 'group[[:space:]]*=[[:space:]]*core' $CONFDIR | cut -d: -f1)
+ ADMIN_PORT=$(grep '^admin-port' $CORE_CONF | sed "s/.*=[[:space:]]*//")
+ ADMIN_PASS=$(grep '^admin-password' $CORE_CONF | sed "s/.*=[[:space:]]*//")
+ STATUS_URL="http://127.0.0.1:${ADMIN_PORT}/status.txt?password=${ADMIN_PASS}"
+ lynx -source $STATUS_URL
+ ;;
+
reload)
# We don't have support for this yet.
exit 1
@@ -83,7 +92,7 @@
;;
*)
- echo "Usage: $0 {start|stop|restart|force-reload}"
+ echo "Usage: $0 {start|stop|status|restart|force-reload}"
exit 1
esac
Index: utils/kannel-init.d
===================================================================
--- utils/kannel-init.d (revision 4888)
+++ utils/kannel-init.d (working copy)
@@ -9,7 +9,8 @@
BOXPATH=/usr/bin
PIDFILES=/var/run
-CONF=/etc/kannel/kannel.conf
+CONFDIR=/etc/kannel
+CONF=$CONFDIR/kannel.conf
USER=kannel
VERSION=""
@@ -50,6 +51,14 @@
echo "."
;;
+ status)
+ CORE_CONF=$(grep -r 'group[[:space:]]*=[[:space:]]*core' $CONFDIR | cut -d: -f1)
+ ADMIN_PORT=$(grep '^admin-port' $CORE_CONF | sed "s/.*=[[:space:]]*//")
+ ADMIN_PASS=$(grep '^admin-password' $CORE_CONF | sed "s/.*=[[:space:]]*//")
+ STATUS_URL="http://127.0.0.1:${ADMIN_PORT}/status.txt?password=${ADMIN_PASS}"
+ lynx -source $STATUS_URL
+ ;;
+
reload)
# We don't have support for this yet.
exit 1
@@ -62,7 +71,7 @@
;;
*)
- echo "Usage: $0 {start|stop|reload|restart|force-reload}"
+ echo "Usage: $0 {start|stop|status|reload|restart|force-reload}"
exit 1
esac