def configure_supervisor(distro): """ Configure supervisor for running our WebVirtMgr Django Gunicorn Server """ if distro in ["Debian", "Ubuntu"]: user = "******" require.supervisor.process( "webvirtmgr", command= "/usr/bin/python /var/www/webvirtmgr/manage.py run_gunicorn -c\ /var/www/webvirtmgr/conf/gunicorn.conf.py", directory="/var/www/webvirtmgr", user=user, stdout_logfile="/var/log/supervisor/webvirtmgr.log", autostart=True, autorestart=True, redirect_stderr=True ) elif distro in ["CentOS", "RHEL", "Fedora"]: # first, ensure supervisord is running! with settings(warn_only=True): require.service.restart("supervisord") supervisord = "/etc/supervisord.conf" if not contains(supervisord, "[program:webvirtmgr]"): f = open("templates/webvirtmgr.ini") content = f.read() f.close() append(supervisord, content, use_sudo=True) reload_config()
def install_services(): install_redis() install_krmt() run('rm -rf /tmp/redis') if not files.exists('/var/run/supervisor.sock'): sudo('supervisord -c /etc/supervisor/supervisord.conf') supervisor.reload_config()
def reload_conf(): """ Reload supervisor config """ reload_config()
def reload_config(): supervisor.reload_config()