Example #1
0
def symlink_check():
    """
    Usage: `fab -R all releases.symlink_check`. Check the hash pointing to the current symlink.
    """
    with cd(env.path_releases):
        print('Current release is %(release)s' % env)
        cmd = "[ -d current ] && echo '1'"
        with fabconfig(hide('everything'), warn_only=True):
            result = run(cmd)
            return result
Example #2
0
def uwsgi(command, newrelic=False):
    """
    Usage: `fab -R all uwsgi:command`. command=start/stop/restart/restart_violent/status, newrelic(optional)=True/False.
    """
    with prefix(env.activate):
        with cd(env.path_release_current) and fabconfig(warn_only=True):
            if command == "start":
                print("Starting uwsgi processes")
                _uwsgi_start(newrelic)
            elif command == "stop":
                print("Stopping uwsgi processes")
                run("uwsgi --stop /tmp/{0}.pid-{1}".format(env.project_name, env.webserver_port))
            elif command == "restart":
                _uwsgi_restart(newrelic)
            elif command == "restart_violent":
                _uwsgi_restart_violent(newrelic)
            elif command == "status":
                _uwsgi_status()