在linux服务器上运行Jar文件时通常的方法是:
$ java -jar test.jar
这种方式特点是ssh窗口关闭时,程序中止运行,或者是运行时没法切出去执行其他任务
$ nohup java -jar test.jar &
$ nohup java -jar test.jar >log_airpurification_device.txt &
nohup 意思是不挂断运行命令,当账户退出或终端关闭时,程序仍然运行
>log_airpurification_device.txt 将运行日志输入到temp.txt
查询当前活动的进程
ps -aux|grep java
关闭进程
kill -9 pid