File: rc.debian.tmpl

package info (click to toggle)
netatalk 3.1.12~ds-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 14,756 kB
  • sloc: ansic: 104,976; sh: 8,247; xml: 7,394; perl: 1,936; makefile: 1,430; python: 1,342; yacc: 309; lex: 49
file content (81 lines) | stat: -rw-r--r-- 1,955 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/sh
### BEGIN INIT INFO
# Provides:          netatalk
# Required-Start:    $remote_fs $syslog
# Should-Start:      avahi-daemon
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
### END INIT INFO
#
# netatalk      Netatalk :NETATALK_VERSION: initscript
#

set -e

. /lib/lsb/init-functions

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Netatalk"
NAME=netatalk
SCRIPTNAME=/etc/init.d/$NAME
DAEMON=:SBINDIR:/netatalk
PIDFILE=/var/run/lock/netatalk

# Guard to prevent execution if netatalk was removed.
test -x $DAEMON || exit 0

status(){
    set +e
    EXIT_CODE=`start-stop-daemon --status --exec $DAEMON; echo $?`
    set -e
    echo $EXIT_CODE
}

case "$1" in
    start)
        EXIT_CODE=`status`
        if [ $EXIT_CODE -ne 0 ]; then
            echo -n "Starting Netatalk"
            start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON
            echo "."
        else
            echo "Netatalk is already running."
        fi
        ;;

    stop)
        echo -n "Stopping Netatalk"
        start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
        echo "."
        ;;

    restart)
        $0 force-reload
        ;;

    force-reload)
        echo -n "Restarting Netatalk Daemons."
        start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PIDFILE
        echo -n "."
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON
        echo -n "."
        echo " Done."
        ;;

    status)
        EXIT_CODE=`status`
        if [ $EXIT_CODE -eq 0 ]; then
            echo "Netatalk is running."
        elif [ $EXIT_CODE -eq 4 ]; then
            echo "Could not access PID file for $NAME."
        else
            echo "Netatalk is not running."
        fi
        exit $EXIT_CODE
        ;;
    *)
        echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
        exit 1
        ;;
esac