Statistics
| Branch: | Tag: | Revision:

root / debian / vncauthproxy.init @ cf664f1a

History | View | Annotate | Download (1.5 kB)

1
#!/bin/sh
2

    
3
### BEGIN INIT INFO
4
# Provides:		vncauthproxy
5
# Required-Start:	$remote_fs $syslog $network
6
# Required-Stop:	$remote_fs $syslog
7
# Should-Start:		
8
# Should-Stop:		
9
# Default-Start:	2 3 4 5
10
# Default-Stop:		0 1 6
11
# Short-Description:	VNC authentication proxy
12
# Description:		VNC authentication proxy
13
### END INIT INFO
14

    
15
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
16
DAEMON=/usr/sbin/vncauthproxy
17
NAME="vncauthproxy"
18
DESC="VNC authentication proxy"
19
RUNDIR=/var/run/$NAME
20
LOGDIR=/var/log/$NAME
21
PIDFILE=$RUNDIR/$NAME.pid
22
CHUID="vncauthproxy:vncauthproxy"
23

    
24
. /lib/lsb/init-functions
25

    
26
test -x $DAEMON || exit 0
27

    
28
DAEMON_OPTS="--pid-file=$PIDFILE"
29

    
30
# Read configuration variable file if it is present
31
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
32

    
33
case "$1" in
34
  start)
35
	mkdir -p $RUNDIR
36
	chown $CHUID $RUNDIR $LOGDIR
37
	chmod 0755 $RUNDIR $LOGDIR
38

    
39
	if pidofproc -p $PIDFILE $DAEMON > /dev/null; then
40
		log_failure_msg "Starting $DESC (already started)"
41
		exit 0
42
	fi
43
	log_daemon_msg "Starting $DESC" "$NAME"
44
	start-stop-daemon --start --quiet --pidfile $PIDFILE \
45
		--chuid $CHUID \
46
		--exec $DAEMON -- $DAEMON_OPTS
47
	log_end_msg $?
48
	;;
49
  stop)
50
	log_daemon_msg "Stopping $DESC" "$NAME"
51
	start-stop-daemon --stop --quiet --pidfile $PIDFILE
52
	case "$?" in
53
		0) log_end_msg 0 ;;
54
		1) log_progress_msg "(already stopped)"
55
		   log_end_msg 0 ;;
56
		*) log_end_msg 1 ;;
57
	esac
58
	;;
59
  force-reload|restart)
60
	$0 stop
61
	$0 start
62
	;;
63
  status)
64
	status_of_proc $DAEMON $NAME
65
	;;
66
  *)
67
	echo "Usage: ${0} {start|stop|restart|force-reload|status}" >&2
68
	exit 1
69
	;;
70
esac