I have a shell script that starts tomcat using 'catalina.sh start'. This script runs fine and starts tomcat which stays up even if I exit from my ssh session.
I am trying to invoke this script from Jsch
shell = new JSch();
session = shell.getSession(user, host, SSH_DEFAULT_PORT);
session.setConfig(config);
session.setPassword(password);
session.connect();
commandChannel = (ChannelExec) session.openChannel("exec");
commandChannel.setCommand(command);
commandChannel.setPty(true);
commandChannel.connect();
This calls my script fine and tomcat starts up, but as soon as the process exits, tomcat is given a shutdown signal and it shuts down. I tried to use setDaemonThread without success. Any idea why this is happening?
UPDATE: The script also does a couple of sudo operations unrelated to starting tomcat so it needs tty. The user is setup in sudoers so as not to require a password, so no prompt is needed.