File: delrconsole

package info (click to toggle)
remote-tty 4.0-13
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, sid, stretch, wheezy
  • size: 212 kB
  • ctags: 219
  • sloc: ansic: 2,100; sh: 340; makefile: 131
file content (32 lines) | stat: -rw-r--r-- 666 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
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh

echo -n "Username                       : "
read USERNAME

#
# Kill any running rtty for that username.
#
if [ -f /var/run/remote-tty/pid/$USERNAME ]; then
	echo -n "Killing running ttysrv: "
	pid=`cat /var/run/remote-tty/pid/$USERNAME`
	tmpfile=`mktemp -t`
	while ps w$pid >$tmpfile 2>&1
	do
		grep -q ttysrv $tmpfile && {
			echo -n " $pid killed"
			kill $pid
			sleep 1
		} || {
			break
		}
	done
	rm /var/run/remote-tty/pid/$USERNAME $tmpfile
	echo
fi

rm -f /etc/remote-tty/dev/$USERNAME
rm -f /etc/remote-tty/owner/$USERNAME.sock
rm -f /etc/remote-tty/opt/$USERNAME.srv
userdel -r $USERNAME
groupdel $USERNAME
rm -rf /var/log/remote-tty/$USERNAME