fab-user
[Top][All Lists]
Advanced

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

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


From: Marshel Helsper
Subject: Re: [Fab-user] How to start tomcat by Fabric with sudo as another user?
Date: Fri, 7 Jun 2013 09:29:35 -0400

What about using the sudo function and specifying the tomcat user?

http://docs.fabfile.org/en/1.6/api/core/operations.html#fabric.operations.sudo

Thanks,

Marshel Helsper
QA/Release Engineer
NetProspex Inc.



On Jun 6, 2013, at 3:02 AM, Reilost <address@hidden> wrote:

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~


_______________________________________________
Fab-user mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user


reply via email to

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