File: sftp-kill

package info (click to toggle)
mysecureshell 2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, stretch, trixie
  • size: 828 kB
  • ctags: 784
  • sloc: ansic: 7,421; sh: 709; perl: 264; makefile: 118
file content (19 lines) | stat: -rw-r--r-- 331 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

[ $1 ] || { 
    echo "
Usage: $0 [username]

username: specify the user name to kill or enter all to kill all"
    exit 0
}

sftp-who --sftp-kill |
while read pid who; do
    shot=1
    [ x$1 = xall ] || [ x$1 = x$who ] && {
	echo Kill $who on PID $pid
	kill -HUP $pid
    }
done
[ $shot ] || echo 'No lamer to kill ?'