Last active
September 15, 2015 15:14
-
-
Save razvancrainea/6c63f82f885e98db0e12 to your computer and use it in GitHub Desktop.
mini opensipsctl script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
REPLY_FIFO_NAME=${REPLY_FIFO_NAME:-opensips-reply-fifo} | |
OSIPS_FIFO=${OSIPS_FIFO:-/tmp/opensips_fifo} | |
COMMAND=${1:-ps} | |
REPLY_FIFO=/tmp/$REPLY_FIFO_NAME | |
rm -f $REPLY_FIFO | |
mkfifo -m777 $REPLY_FIFO | |
# send the command | |
BUF=":$COMMAND:$REPLY_FIFO_NAME\n\n" | |
echo -e "Command is: [$BUF]" | |
echo -ne "$BUF" > $OSIPS_FIFO | |
# get the reply | |
BUF=$(cat $REPLY_FIFO) | |
echo -e "Response is: [$BUF]" | |
rm -f $REPLY_FIFO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment