File: netatalk.init

package info (click to toggle)
netatalk 2.0.3-4%2Betch2
  • links: PTS
  • area: main
  • in suites: etch
  • size: 9,012 kB
  • ctags: 6,109
  • sloc: ansic: 67,633; sh: 8,424; perl: 1,187; makefile: 1,001
file content (112 lines) | stat: -rw-r--r-- 2,506 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/sh

# Guard to prevent execution of netatalk was removed.
test -x /usr/sbin/atalkd || exit 0

# Set defaults. Please change these options in /etc/default/netatalk.
AFPD_UAMLIST="-U uams_dhx.so,uams_clrtxt.so,uams_randnum.so"
AFPD_GUEST=nobody
AFPD_MAX_CLIENTS=50
ATALK_ZONE=
ATALK_NAME=`/bin/hostname --short`
ATALK_BGROUND=no

# Read in netatalk configuration.
if [ -f /etc/default/netatalk ]; then
  . /etc/default/netatalk
fi

# Start Netatalk servers.
atalk_startup() {
    if [ "$ATALKD_RUN" = "yes" ]; then
	# Quickly probe for appletalk if it was supposed to be loaded.
	if grep -q '^appletalk$' /etc/modules; then
	    /sbin/modprobe appletalk || echo "[could not load appletalk module]"
	fi

	# Start atalkd server.
	/usr/sbin/atalkd

	# register workstation
	/usr/bin/nbprgstr -p 4 "$ATALK_NAME:Workstation$ATALK_ZONE"
	/usr/bin/nbprgstr -p 4 "$ATALK_NAME:netatalk$ATALK_ZONE"

	echo -n " atalkd"

	if [ "$PAPD_RUN" = "yes" ]; then
	    /usr/sbin/papd
	    echo -n " papd"
	fi

	if [ "$TIMELORD_RUN" = "yes" ]; then
	    /usr/sbin/timelord
	    echo -n " timelord"
	fi

    fi

    if [ "$AFPD_RUN" = "yes" ]; then
	/usr/sbin/afpd $AFPD_UAMLIST -g $AFPD_GUEST -c $AFPD_MAX_CLIENTS -n "$ATALK_NAME$ATALK_ZONE"
	echo -n " afpd"
    fi

    if [ "$CNID_METAD_RUN" = "yes" ]; then
	/usr/sbin/cnid_metad
	echo -n " cnid_metad"
    fi

}


case "$1" in
    start)
	if test "x${ATALK_BGROUND}" = "xyes"; then
	    echo "Starting AppleTalk services in the background."
	    atalk_startup >/dev/null &
	else
	    echo -n "Starting AppleTalk services (this will take a while): "
	    atalk_startup
	    echo "."
	fi
    ;;

    stop)
	echo -n "Stopping AppleTalk Daemons:"
	echo -n " afpd"; \
	start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/afpd

	echo -n " papd"; \
	start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/papd

	echo -n " timelord"; \
	start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/timelord

	echo -n " atalkd"; \
	start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/atalkd

	echo -n " cnid_metad"; \
	start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/cnid_metad

	echo "."
    ;;
    
    restart)
	$0 force-reload
    ;;

    force-reload)
	echo -n "Restarting AppleTalk Daemons (this will take a while)"
	/etc/init.d/netatalk stop
	echo -n "."
	sleep 2
	echo -n "."
	if /etc/init.d/netatalk start; then
		echo "done."
	fi
    ;;
  
    *)
	echo "Usage: /etc/init.d/netatalk {start|stop|restart|force-reload}" >&2
	exit 1
    ;;
esac