使用 nohup 命令挂起服务程序,启动命令如下
nohup python -u test.py > test_out.out 2>&1 &
命令含义说明:
使用 jobs 命令:
[root@localhost test]# jobs
[4]+ Running nohup python -u test.py > test_out.out 2>&1 &
使用 ps -ef | grep python 或者 ps -ef | grep Job 命令,查看进程
# ps -ef|grep python
或
# ps -ef|grep Job
使用 ps aux 命令,查看程序的进程号
[root@localhost test]# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 22246 0.0 0.3 125572 6304 pts/0 S 17:29 0:00 python -u test.py
使用 kill -9 进程号,关闭指定进程号的程序
[root@localhost test]# kill -9 60000