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~ |