Skip to content

Instantly share code, notes, and snippets.

@razvancrainea
Last active September 15, 2015 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save razvancrainea/6c63f82f885e98db0e12 to your computer and use it in GitHub Desktop.
Save razvancrainea/6c63f82f885e98db0e12 to your computer and use it in GitHub Desktop.
mini opensipsctl script
#!/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