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 DisqusMost Read Posts in Technology
About
Read about IT, Migration, Business, Money, Marketing and other subjects.
Some subjects: FusionPBX, FreeSWITCH, Linux, Security, Canada, Cryptocurrency, Trading.