Start server

def start_webserver(server):
    """
    Start server
    """
    if server == 'apache2':
        with settings(warn_only=True):
            if env.verbosity:
                print env.host,"STARTING apache2"
            #some issues with pty=True getting apache to start on ec2
            a = sudo("/etc/init.d/apache2 start", pty=False)
            if env.verbosity:
                print '',a
            
        if a.failed:
            print "ERROR: /etc/init.d/apache2 start failed"
            print env.host, a
            sys.exit(1)
    elif server == 'nginx':
        if env.verbosity:
            #Reload used to fail on Ubuntu but at least in 10.04 it works
            print env.host,"RELOADING nginx"
        with settings(warn_only=True):
            s = run("/etc/init.d/nginx status")
            if 'running' in s:
                n = sudo("/etc/init.d/nginx reload")
            else:
                n = sudo("/etc/init.d/nginx start")
        if env.verbosity:
            print ' *',n
    else:
        if env.verbosity:
            print env.host, "STARTING","%s-%s"% (server,env.project_name)
        with settings(warn_only=True):
            n = sudo('start %s-%s'% (server,env.project_name))
            if env.verbosity and n.strip():
                print ' *', n
            
    return True