示例#1
0
文件: redis.py 项目: Sportamore/blues
def info(scope=''):
    """
    Get runtime information from redis itself
    """
    with silent(), hide_prefix():
        output = api.run('redis-cli info ' + scope)
        api.info(output)
示例#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')))
示例#3
0
文件: cron.py 项目: Sportamore/blues
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))
示例#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)
示例#5
0
文件: django.py 项目: gotling/blues
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')))
示例#6
0
文件: uwsgi.py 项目: lericson/blues
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))
示例#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)
示例#8
0
文件: shell.py 项目: Sportamore/blues
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))
示例#9
0
文件: percona.py 项目: 5monkeys/blues
def mysqltuner():
    """
    Run mysqltuner
    """
    with hide_prefix():
        run('sudo su root -c mysqltuner')
示例#10
0
def tail():
    with sudo('solr'), hide_prefix(), settings():
        try:
            run('tail -100f /var/log/solr/solr.log')
        except KeyboardInterrupt:
            pass
示例#11
0
def mysqltuner():
    """
    Run mysqltuner
    """
    with hide_prefix():
        run('sudo su root -c mysqltuner')
示例#12
0
文件: solr.py 项目: zalphi/blues
def tail():
    with sudo("solr"), hide_prefix(), settings():
        try:
            run("tail -100f /var/log/solr/solr.log")
        except KeyboardInterrupt:
            pass