Jetty 9 安装在 EC2 linux 服务器上,jetty.sh 被复制到 /etc/init.d 并在 /etc/rc1.d、/etc/rc2.d 建立了正确的链接。
我正在使用 SSH 连接到实例,并运行 jetty 通过sudo service jetty start
它正确加载服务,即使在注销 SSH 会话之后也是如此。
但是,ssh -t -i key.pem ec2-user@instance.domain.com 'sudo service jetty restart'
在我的实例上运行远程 SSH 命令时,它会启动,但之后会立即停止。这是日志:
2013-11-14 18:03:01 main DispatcherServlet [INFO] FrameworkServlet 'restapi': initialization completed in 1376 ms
2013-11-14 18:03:01.824:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@67fc3482{/,file:/usr/share/jetty/jetty-distribution-9.0.6.v20130930/webapps/ROOT/,AVAILABLE}{/ROOT}
2013-11-14 18:03:01.941:INFO:oejs.ServerConnector:main: Started ServerConnector@10614f3d{HTTP/1.1}{0.0.0.0:8080}2013-11-14 18:03:02.226:INFO:oejs.ServerConnector:main: Started ServerConnector@666c1838{SSL-http/1.1}{0.0.0.0:8443}2013-11-14 18:03:05.670:INFO:oejs.ServerConnector:Thread-3: Stopped ServerConnector@10614f3d{HTTP/1.1}{0.0.0.0:8080}
2013-11-14 18:03:05.671:INFO:oejs.ServerConnector:Thread-3: Stopped ServerConnector@666c1838{SSL-http/1.1}{0.0.0.0:8443}
我试过远程执行sudo nohup service jetty restart &
,同样的结果。
如何远程重启(SSH)并保持运行?