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.
[email protected]



On Jun 6, 2013, at 3:02 AM, Reilost <[email protected]> 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
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/fab-user

_______________________________________________
Fab-user mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to