Browse Source

added a convience function to flush memcache (requires nc to be installed)

3.12
K Anderson 15 years ago
parent
commit
7e6b7006aa
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      opensips/dispatcher.sh

+ 8
- 1
opensips/dispatcher.sh View File

@ -3,7 +3,7 @@ DISPATCHER_FILE="/usr/local/etc/opensips/dispatcher.list"
OSIP_CTL="/usr/local/etc/opensips/opensipsctl" OSIP_CTL="/usr/local/etc/opensips/opensipsctl"
fUsage () { 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 exit 1
} }
@ -25,6 +25,9 @@ while [ -n "$*" ]; do
x-r) x-r)
action="r" action="r"
;; ;;
x-f)
action="f"
;;
x--help) x--help)
fUsage fUsage
;; ;;
@ -43,6 +46,10 @@ elif [ $action == "r" ]; then
echo "# $OSIP_CTL fifo ds_reload" echo "# $OSIP_CTL fifo ds_reload"
$OSIP_CTL fifo ds_reload $OSIP_CTL fifo ds_reload
exit 0 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 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`" 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` $OSIP_CTL fifo ds_set_state $action `grep $server $DISPATCHER_FILE | cut -d' ' -f 1` `grep $server $DISPATCHER_FILE | cut -d' ' -f 2`


Loading…
Cancel
Save