Screen kill 的两种办法

##两种中断 screen 任务的方法

1 Screen -r

screen -ls 

There is a screen on:
	30339.pyapi	(Detached)
1 Socket in /var/run/screen/S-root.

screen -r 30339        //进入要中断的screen

exit        //exit 或者 control +c 退出 screen

2 Screen -S screenID -X quit

[root@localhost ~]# screen -ls
There is a screen on:
    41493.pyapi    (Detached)
1 Socket in /var/run/screen/S-root.

[root@localhost ~]# screen  -S 41493.pyapi -X quit
[root@localhost ~]# screen -ls
No Sockets found in /var/run/screen/S-root.

3 杀死所有 screen 任务

1、先看看有多少个screen
   screen -ls |awk '/Socket/'|awk '{print $1}'
2、如果有 N 个screen,关闭所有screen
   screen -ls|awk 'NR>=2&&NR<=N{print $1}'|awk '{print "screen -S "$1" -X quit"}'|sh

你可能感兴趣的:(linux)