VoIP, Linux, Security & much more fun
If you need any help regarding these subjects do not hesitate about sending me a text

Now that I am managing some cluster with a lot of activity, one of the most common issues is when a user does a change he wants it right away. This is almost true for the most part of the things, but there are some things, such as music on hold or call center. The thing here is that in order to take the new settings, FreeSWITCH requires a module reload; sadly, the module cannot be reloaded if it is being used.

I wrote the following script in order to help system managers to deal with this.

#!/bin/bash


OIFS=$IFS
IFS=$'\n'

while : ; do
       o=($(fs_cli -x "reload $1"))
       [[ ${o[1]:0:4} == "-ERR" ]] || break
       [[ ${o[2]:0:4} == "-ERR" ]] || break
       sleep 5 
done

The script will try to reload the module using the fs_cli utility. If the utility returns the string -ERR in the second or third line, it means it has failed and then it will retry. Sadly, this command line doesn't return an error state in the $? variable, it is always zero.

To run it, just put as argument the name of the module. You can also put it in a crontab so it will try to reload something each hour (or when it gets free).

Good Luck

blog comments powered by Disqus
If you need more help than the free one provided here...