fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fab-user] How to start tomcat by Fabric with sudo as another user?


From: Reilost
Subject: [Fab-user] How to start tomcat by Fabric with sudo as another user?
Date: Thu, 6 Jun 2013 15:02:01 +0800

My ubuntu server is login server by ssh key and user is ubuntu. and tomcat user is tomcat and it's password is tomcat . I want to start tomcat by Fabric . and my method is like this,login in user is ubuntu ,and want to su user tomcat : but i had a errot is su: must be run from a terminal if i remove the pty=False it will run the startup.sh but will close after fabric finish.

suuser(user='tomcat',pwd='tomcat',command= '/data/tomcat/%s/bin/startup.sh '%port,pty=False)

def suuser(user,pwd,command='',pty=True):

with settings(password= "%s" % pwd,
    sudo_prefix="su  %s -c " % user,
    sudo_prompt="Password:"):
    sudo(command,pty=pty)

someone can help me ? thank u~


reply via email to

[Prev in Thread] Current Thread [Next in Thread]