阿里云服务器XShell连接启动java -jar xxx.jar后退出ssh,后端也退出,使用screen 亲测管用!
使用screen工具, 1、下载screen: CentOS 系列系统: yum install screen Ubuntu 系列系统: sudo apt-get install screen 2、运行screen,创建一个screen screen -S [name] [name] 是一个标记,可以自己随便填,这个标记是给自己看的,用来分辨该窗口的用途,避免窗口多了自己混淆 3、查看screen在后台运行的进程 screen -ls 4、进入查看后台运行的screen进程 screen -r -d [PID号] screen -r -d 1020 5、杀死不需要的进程 kill -9 【PID号】 kill -9 1020 6、清理screen已经死亡的进程信息 screen -wipe (检查目前所有的screen作业,并删除已经无法使用的screen作业)
参考
如何让自己的写的程序在阿里云一直运行_阿里云 maxcompute 数据开发 如何设置自动运行-CSDN博客文章浏览阅读4.9k次,点赞9次,收藏34次。购买了阿里云服务器后,每次要用自己写在阿里云的服务器程序都要连接到云端然后./运行该程序,而且每次一断开终端,该服务器就会自动停止,这样使用相当麻烦。那怎样才能让我们的服务器一直在云端后台运行,即便退出终端,也保持这个服务器进程运行呢?这里我们可以使用screen工具:1、下载screen:CentOS 系列系统: yum install screen Ubuntu 系列系统: sudo apt-get install screen 2、运行scr_阿里云 maxcompute 数据开发 如何设置自动运行https://blog.csdn.net/bhbhhyg/article/details/107742311