File: init

package info (click to toggle)
ziproxy 3.3.2-7
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,084 kB
  • sloc: ansic: 9,864; sh: 1,705; makefile: 37
file content (66 lines) | stat: -rw-r--r-- 1,726 bytes parent folder | download | duplicates (5)
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
63
64
65
66
#!/bin/sh
### BEGIN INIT INFO
# Provides:          ziproxy
# Required-Start:    $remote_fs $network
# Required-Stop:     $remote_fs $network 
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Init script for ziproxy
# Description:       This is the init script for ziproxy.
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/ziproxy
NAME=ziproxy
DESC=ziproxy

test -x $DAEMON || exit 0

. /lib/lsb/init-functions

PIDFILE=/var/run/$NAME.pid
DODTIME=1                   # Time to wait for the server to die, in seconds
                            # If this value is set too low you might not
                            # let some servers to die gracefully and
                            # 'restart' will not work

if [ ! -d /var/run ]; then
	mkdir -p /var/run
fi

# Include ziproxy defaults if available
if [ -f /etc/default/ziproxy ] ; then
	. /etc/default/ziproxy
fi
DAEMON_OPTS="$DAEMON_OPTS -d -p $PIDFILE"

case "$1" in
    start)
        log_daemon_msg "Starting $DESC" "$NAME"
        start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS
        log_end_msg $?
	;;
    stop)
        log_daemon_msg "Stopping $DESC" "$NAME"
        killproc -p $PIDFILE $DAEMON
        RETVAL=$?
        [ $RETVAL -eq 0 ] && [ -e "$PIDFILE" ] && rm -f $PIDFILE
        log_end_msg $RETVAL
	;;
    restart|reload|force-reload)
        log_daemon_msg "Restarting $DESC" "$NAME" 
        $0 stop
	[ -n "$DODTIME" ] && sleep $DODTIME
        $0 start
	;;
    status)
        status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
	;;
    *)
	N=/etc/init.d/$NAME
	log_action_msg "Usage: $N {start|stop|restart|reload|force-reload|status}"
	exit 1
	;;
esac

exit 0