File: initd

package info (click to toggle)
userv 1.2.0
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, stretch
  • size: 700 kB
  • ctags: 1,013
  • sloc: ansic: 4,220; lex: 287; sh: 207; makefile: 206
file content (62 lines) | stat: -rw-r--r-- 1,390 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh

### BEGIN INIT INFO
# Provides:		userv
# Required-Start:	$remote_fs $syslog
# Required-Stop:	$remote_fs $syslog
# Default-Start:	2 3 4 5
# Default-Stop:		0 1 6
# Short-Description:	userv services daemon uservd
# Description:          User services (security boundary) daemon
### END INIT INFO

test -f /usr/sbin/uservd || exit 0

ensure_var_dir () {
	var_dir=/var/run/userv
	test -d "$var_dir" || mkdir -m700 "$var_dir"
}

case "$1" in
start)
	echo -n "Starting user services daemon: uservd"
	ensure_var_dir
	start-stop-daemon --start --quiet --exec /usr/sbin/uservd -- -daemon
	echo "."
	;;

stop)
	echo -n "Stopping user services daemon: uservd"
	start-stop-daemon --stop --quiet --user root --exec /usr/sbin/uservd
	echo "."
	;;

restart)
	echo -n "Restarting user services daemon: uservd"
	ensure_var_dir
	start-stop-daemon --stop --oknodo --quiet --user root \
		--exec /usr/sbin/uservd
	sleep 1
	start-stop-daemon --start --quiet --exec /usr/sbin/uservd -- -daemon
	echo "."
	;;

reload | force-reload)
	;;

# draft implementation of status support
# commented out pending inclusion into policy of firm specification
#status)
#	userv -B version >/dev/null 2>/dev/null
#	case $? in
#	0)	echo 'uservd running ok'; exit 0;;
#	*)	echo 'uservd not running'; exit 3;;
#	esac
#	;;

*)
	echo "Usage: /etc/init.d/userv {start|stop|restart|reload|force-reload}"
	exit 1
esac

exit 0