1、查看端口是否开放
netstat -ntlp | grep 9998
lsof -i:9998
查看对应的PID进程号,已经运行的文件
cd /proc/83086
ll
cd cwd
ll
2、进程
ps aux | grep amoeba #查到amoeba的进程
$ kill -s 9 pid # 杀死进程
3、挂起
sh test.sh &
将sh test.sh任务放到后台 ,关闭xshell,对应的任务也跟着停止。
nohup sh test.sh
将sh test.sh任务放到后台,关闭标准输入,终端不再能够接收任何输入(标准输入),重定向标准输出和标准错误到当前目录下的nohup.out文件,即使关闭xshell退出当前session依然继续运行。
nohup sh test.sh &
将sh test.sh任务放到后台,但是依然可以使用标准输入,终端能够接收任何输入,重定向标准输出和标准错误到当前目录下的nohup.out文件,即使关闭xshell退出当前session依然继续运行。
nohup command > myout.file 2>&1 &
在上面的例子中,0 – stdin (standard input),1 – stdout (standard output),2 – stderr (standard error) ;
2>&1是将标准错误(2)重定向到标准输出(&1),标准输出(&1)再被重定向输入到myout.file文件中。
tail -f nohup.out
查看实时日志
tail -f nohup.out | grep "关键字"
查看实时日志并检索关键字
tail -n 100 nohup.out | more