def info(scope=''): """ Get runtime information from redis itself """ with silent(), hide_prefix(): output = api.run('redis-cli info ' + scope) api.info(output)
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')))
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))
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)
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')))
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))
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)
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))
def mysqltuner(): """ Run mysqltuner """ with hide_prefix(): run('sudo su root -c mysqltuner')
def tail(): with sudo('solr'), hide_prefix(), settings(): try: run('tail -100f /var/log/solr/solr.log') except KeyboardInterrupt: pass
def tail(): with sudo("solr"), hide_prefix(), settings(): try: run("tail -100f /var/log/solr/solr.log") except KeyboardInterrupt: pass