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 error 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)