root / debian / vncauthproxy.init @ 63b66016
History | View | Annotate | Download (1.7 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 |
LIBDIR=/var/lib/$NAME |
22 |
PIDFILE=$RUNDIR/$NAME.pid |
23 |
CHUID="vncauthproxy:vncauthproxy" |
24 |
|
25 |
. /lib/lsb/init-functions |
26 |
|
27 |
test -x $DAEMON || exit 0 |
28 |
|
29 |
DAEMON_OPTS="--pid-file=$PIDFILE" |
30 |
|
31 |
# Read configuration variable file if it is present |
32 |
[ -r /etc/default/$NAME ] && . /etc/default/$NAME |
33 |
|
34 |
case "$1" in |
35 |
start) |
36 |
# Probably not needed anymore |
37 |
mkdir -p $RUNDIR |
38 |
|
39 |
chown -R $CHUID $RUNDIR $LOGDIR $LIBDIR |
40 |
chmod 0750 $RUNDIR $LOGDIR |
41 |
chmod 0755 $LIBDIR |
42 |
|
43 |
if [ -s $LIBDIR/users ] |
44 |
then |
45 |
chmod 0640 $LIBDIR/users |
46 |
fi |
47 |
|
48 |
if pidofproc -p $PIDFILE $DAEMON > /dev/null; then |
49 |
log_failure_msg "Starting $DESC (already started)" |
50 |
exit 0 |
51 |
fi |
52 |
log_daemon_msg "Starting $DESC" "$NAME" |
53 |
start-stop-daemon --start --quiet --pidfile $PIDFILE \ |
54 |
--chuid $CHUID \ |
55 |
--exec $DAEMON -- $DAEMON_OPTS |
56 |
log_end_msg $? |
57 |
;; |
58 |
stop) |
59 |
log_daemon_msg "Stopping $DESC" "$NAME" |
60 |
start-stop-daemon --stop --quiet --pidfile $PIDFILE |
61 |
case "$?" in |
62 |
0) log_end_msg 0 ;; |
63 |
1) log_progress_msg "(already stopped)" |
64 |
log_end_msg 0 ;; |
65 |
*) log_end_msg 1 ;; |
66 |
esac |
67 |
;; |
68 |
force-reload|restart) |
69 |
$0 stop |
70 |
$0 start |
71 |
;; |
72 |
status) |
73 |
status_of_proc $DAEMON $NAME |
74 |
;; |
75 |
*) |
76 |
echo "Usage: ${0} {start|stop|restart|force-reload|status}" >&2 |
77 |
exit 1 |
78 |
;; |
79 |
esac |