]> arthur.barton.de Git - netatalk.git/blob - distrib/debian/netatalk.init
Enhanced machine type
[netatalk.git] / distrib / debian / netatalk.init
1 #!/bin/sh
2
3 test -x /usr/sbin/atalkd || exit 0
4
5 # Set defaults. Please change these options in /etc/default/netatalk.
6 AFPD_UAMLIST="-U uams_clrtxt.so,uams_randnum.so"
7 AFPD_GUEST=nobody
8 AFPD_MAX_CLIENTS=20
9 ATALK_NAME=`/bin/hostname --short`
10
11 # Read in netatalk configuration.
12 if [ -f /etc/default/netatalk ]; then
13   . /etc/default/netatalk
14 fi
15
16 OPTIONS_AFP="$AFPD_UAMLIST -g $AFPD_GUEST -c $AFPD_MAX_CLIENTS -n $ATALK_NAME"
17
18 case "$1" in
19     start)
20         if [ "$ATALKD_RUN" = "yes" ]; then
21                 # Quickly probe for appletalk if it was supposed to be loaded
22                 if grep '^appletalk$' /etc/modules; then
23                         /sbin/modprobe appletalk || echo "[could not load appletalk module]"
24                 fi
25
26                 echo -n "Starting AppleTalk Daemons (this will take a while):"
27                 /usr/sbin/atalkd
28                 echo -n " atalkd"
29
30                 /usr/bin/nbprgstr -p 4 "$ATALK_NAME:Workstation"
31                 /usr/bin/nbprgstr -p 4 "$ATALK_NAME:netatalk"
32         fi
33
34         if [ "$AFPD_RUN" = "yes" ]; then
35                 /usr/sbin/afpd $OPTIONS_AFP
36                 echo -n " afpd"
37         fi
38
39         if [ "$ATALKD_RUN" = "yes" -a "$PAPD_RUN" = "yes" ]; then
40                 /usr/sbin/papd
41                 echo -n " papd"
42         fi
43
44         if [ "$TIMELORD_RUN" = "yes" ]; then
45                 /usr/sbin/timelord
46                 echo -n " timelord"
47         fi
48
49         echo "."
50     ;;
51
52     stop)
53         echo -n "Stopping AppleTalk Daemons:"
54         echo -n " afpd"; \
55         start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/afpd
56
57         echo -n " papd"; \
58         start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/papd
59
60         echo -n " timelord"; \
61         start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/timelord
62
63         echo -n " atalkd"; \
64         start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/atalkd
65
66         echo "."
67     ;;
68     
69     restart)
70         $0 force-reload
71     ;;
72
73     force-reload)
74         echo -n "Restarting AppleTalk Daemons (this will take a while)"
75         /etc/init.d/netatalk stop > /dev/null 2>&1
76         echo -n "."
77         sleep 2
78         echo -n "."
79         if /etc/init.d/netatalk start > /dev/null 2>&1; then
80                 echo "done."
81         fi
82     ;;
83   
84     *)
85         echo "Usage: /etc/init.d/netatalk {start|stop|restart|force-reload}" >&2
86         exit 1
87     ;;
88 esac
89