From 7e6b7006aa33e74c82a678a8d1a2373ebbf125c7 Mon Sep 17 00:00:00 2001 From: K Anderson Date: Tue, 23 Aug 2011 13:14:48 -0700 Subject: [PATCH] added a convience function to flush memcache (requires nc to be installed) --- opensips/dispatcher.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) mode change 100644 => 100755 opensips/dispatcher.sh diff --git a/opensips/dispatcher.sh b/opensips/dispatcher.sh old mode 100644 new mode 100755 index c8f2e47..524e549 --- a/opensips/dispatcher.sh +++ b/opensips/dispatcher.sh @@ -3,7 +3,7 @@ DISPATCHER_FILE="/usr/local/etc/opensips/dispatcher.list" OSIP_CTL="/usr/local/etc/opensips/opensipsctl" fUsage () { - echo "Usage: $0 [Media Server IP] [-a active] [-i inactive] [-p probing] [-r reload]" + echo "Usage: $0 [-r reload] [-f flush] [Media Server IP] [-a active] [-i inactive] [-p probing]" exit 1 } @@ -25,6 +25,9 @@ while [ -n "$*" ]; do x-r) action="r" ;; + x-f) + action="f" + ;; x--help) fUsage ;; @@ -43,6 +46,10 @@ elif [ $action == "r" ]; then echo "# $OSIP_CTL fifo ds_reload" $OSIP_CTL fifo ds_reload exit 0 +elif [ $action == "f" ]; then + echo "# echo \"flush_all\" | nc localhost 11211" + echo "flush_all" | nc localhost 11211 + exit 0 elif grep -q $server $DISPATCHER_FILE; then echo "# $OSIP_CTL fifo ds_set_state $action `grep $server $DISPATCHER_FILE | cut -d' ' -f 1` `grep $server $DISPATCHER_FILE | cut -d' ' -f 2`" $OSIP_CTL fifo ds_set_state $action `grep $server $DISPATCHER_FILE | cut -d' ' -f 1` `grep $server $DISPATCHER_FILE | cut -d' ' -f 2`