検索条件
全3件
(1/1ページ)
$ ps x | grep pts | grep sshd
13819 ? S 0:00 sshd: kero@pts/2
13985 ? S 0:00 sshd: kero@pts/8
14595 pts/2 S+ 0:00 grep sshd
grepが走っているpts/2が現在操作中のポートなので、pts/8を落とす。
$ kill -KILL 13985
$ screen -ls
There is a screen on:
9120.pts-0.spinel (Multi, detached)
1 Socket in /var/run/screen/S-kero.
$ screen -r
これで自動的にdetatchされ(autodetatchがonの場合)再アタッチ可能になる。
#!/usr/bin/perl
use strict;
(my $tty = `echo -n \$SSH_TTY`) =~ s/\/dev\///;
my $dead = `ps x | grep pts | grep sshd | grep -v $tty | grep -v grep`;
foreach(split(/\n/, $dead)){
$_ =~ s/^\s*(\d+).+$/$1/;
print qq|Kill pid=$_...\n|;
`kill -KILL $_`;
}


