How do I set up Supervisord for FreeSWITCH?
I am trying to configure Supervisor to manage FreeSWITCH . Below is the configuration currently in supervisord.conf
.
[program:freeswitch]
command=/usr/local/freeswitch/bin/freeswitch -nc -u root -g root
numprocs=1
stdout_logfile=/var/log/supervisor/freeswitch.log
stderr_logfile=/var/log/supervisor/freeswitch.log
autostart=true
autorestart=true
startsecs=10
; Need to wait for currently executing tasks to finish at shutdown.
; Increase this if you have very long running tasks.
stopwaitsecs = 600
; When resorting to send SIGKILL to the program to terminate it
; send SIGKILL to its whole process group instead,
; taking care of its children as well.
killasgroup=true
When I start the supervisor using the command supervisord
, it starts the freeswitch process without any error. But when I try to restart freeswitch using command supervisorctl
, it doesn't work and gives the following errors.
freeswitch: ERROR (not running)
freeswitch: ERROR (abnormal termination)
I don't see any error messages in the log (/var/log/supervisor/freeswitch.log). However, I see the following:
1773 Backgrounding.
1777 Backgrounding.
1782 Backgrounding.
It seems to start three freeswitch processes. Isn't that so?
Can anyone point out what the problem is here and provide correct configuration if required?
source to share
supervisor
requires running programs not to be forked to the background; after all, it was created to run as background processes those programs for which it would be impossible or correct to make the correct daemonizing code. This way, for every program you run with supervisor, make sure it is not running in the background.
In the case of freeswitch, just remove the parameter -nc
to make it work in the foreground; the supervisor will route the standard streams accordingly and restart the process if it crashes.
source to share
Keep in mind that processes inherit the ulimits values of the parent process, so in your case freeswitch will run with the same ulimits as its parent supervisor ... which I don't think you want a ressource-intensive application like freeswitch is says that using supervisord with freeswitch is actually a very bad idea. if you have to stick with it, you will need to learn from the documentation how to raise all ulimits for the supervisor.
source to share