Source

django-fab-deploy-ext / fab_deploy_ext / supervisor.py

from fabric.api import sudo
from fabric.api import cd

from fab_deploy import utils


__all__ = ['supervisor_install', 'supervisord', 'supervisorctl',
           'supervisor_create_log_dir']


@utils.run_as_sudo
def supervisor_install():
    sudo('pip install --upgrade supervisor')


@utils.run_as_sudo
def supervisord():
    with cd(env.conf.SRC_DIR):
        sudo('supervisord --configuration=/etc/supervisord.conf')


@utils.run_as_sudo
def supervisorctl(command=''):
    with cd(env.conf.SRC_DIR):
        sudo('supervisorctl --configuration=/etc/supervisord.conf %s' % command)


@utils.run_as_sudo
def supervisor_create_log_dir():
    sudo('mkdir --parents /var/log/supervisord')