Exemplo n.º 1
0
def info(scope=''):
    """
    Get runtime information from redis itself
    """
    with silent(), hide_prefix():
        output = api.run('redis-cli info ' + scope)
        api.info(output)
Exemplo n.º 2
0
def manage(cmd=''):
    """
    Run django management command
    """
    if not cmd:
        cmd = prompt('Enter django management command:')
    with sudo_project(), cd(python_path()), virtualenv.activate(virtualenv_path()), hide_prefix():
        return run('python {manage} {cmd}'.format(cmd=cmd, manage=blueprint.get('manage', 'manage.py')))
Exemplo n.º 3
0
def status(user=None):
    """
    Dumps the crontab for a single user
    """
    if not user:
        abort('Please specify user account')

    info('Current crontab for {}:', user)
    with sudo(), hide_prefix():
        run('crontab -l -u {}'.format(user))
Exemplo n.º 4
0
def ctl(command, program=''):
    """
    Run supervisorctl :[command],[program]

    :param command: The command to run
    :param program: The program to run command against
    """
    with silent():
        output = supervisorctl(command, program=program)
        with hide_prefix():
            info(output)
Exemplo n.º 5
0
def manage(cmd=''):
    """
    Run django management command
    """
    if not cmd:
        cmd = prompt('Enter django management command:')
    with sudo_project(), cd(python_path()), virtualenv.activate(
            virtualenv_path()), hide_prefix():
        return run('python {manage} {cmd}'.format(cmd=cmd,
                                                  manage=blueprint.get(
                                                      'manage', 'manage.py')))
Exemplo n.º 6
0
def top(vassal_name=None):
    """
    Launch uwsgitop for vassal stats socket

    :param vassal_name: The vassal to show stats for (Default: project setting)
    """
    # TODO: fix missing output
    with sudo(), hide_prefix():
        vassal = vassal_name or blueprint.get('project')
        stats_path = os.path.join(tmpfs_path, '{}-stats.sock'.format(vassal))
        run('uwsgitop {}'.format(stats_path))
Exemplo n.º 7
0
def ctl(command, program=""):
    """
    Run supervisorctl :[command],[program]

    :param command: The command to run
    :param program: The program to run command against
    """
    with silent():
        output = supervisorctl(command, program=program)
        with hide_prefix():
            info(output)
Exemplo n.º 8
0
def grep(needle, haystack, flags="i"):
    """
    Basic file grepping, case-insensitive by default
    """

    if not needle and haystack:
        abort('Missing arguments')

    with hide_prefix(), sudo():
        run('grep{} -e "{}" {}'.format(
            ' -{}'.format(flags) if flags else '',
            needle,
            haystack))
Exemplo n.º 9
0
def mysqltuner():
    """
    Run mysqltuner
    """
    with hide_prefix():
        run('sudo su root -c mysqltuner')
Exemplo n.º 10
0
def tail():
    with sudo('solr'), hide_prefix(), settings():
        try:
            run('tail -100f /var/log/solr/solr.log')
        except KeyboardInterrupt:
            pass
Exemplo n.º 11
0
def mysqltuner():
    """
    Run mysqltuner
    """
    with hide_prefix():
        run('sudo su root -c mysqltuner')
Exemplo n.º 12
0
Arquivo: solr.py Projeto: zalphi/blues
def tail():
    with sudo("solr"), hide_prefix(), settings():
        try:
            run("tail -100f /var/log/solr/solr.log")
        except KeyboardInterrupt:
            pass