]> arthur.barton.de Git - netatalk.git/blob - distrib/initscripts/rc.atalk.redhat.tmpl
Ugh. Removed superfluous files.
[netatalk.git] / distrib / initscripts / rc.atalk.redhat.tmpl
1 #! /bin/sh
2 # chkconfig: 345 91 35
3 # description: This package enables Linux to talk to Macintosh
4 #              computers via the AppleTalk networking protocol and 
5 #              provides printer, file sharing, and AppleTalk routing 
6 #              services.   
7 #
8 # AppleTalk daemons. Make sure not to start atalkd in the background:
9 # its data structures must have time to stablize before running the
10 # other processes.
11
12 ATALK_BIN=:BINDIR:
13 ATALK_CONF_DIR=:ETCDIR:
14 ATALK_SBIN=:SBINDIR:
15
16 # Source function library.
17 . /etc/rc.d/init.d/functions
18
19 # Source networking configuration.
20 . /etc/sysconfig/network
21
22 # Quickly probe for appletalk and warn if we can't find it
23 /sbin/modprobe appletalk || echo "[could not load appletalk module]"
24
25 # Check for IP Encapsulation support
26 #/sbin/modprobe ipddp || echo "[could not load IP encapsulation]"
27
28 test -x ${ATALK_SBIN}/atalkd || exit 0
29
30 test -f ${ATALK_CONF_DIR}/netatalk.conf || exit 0
31
32 # read in netatalk configuration
33 . ${ATALK_CONF_DIR}/netatalk.conf
34
35 # Check that networking is up.
36 [ ${NETWORKING} = "no" ] && exit 0
37
38 # initialize return values
39 RETVAL=1
40 RETVAL_ATALKD=0
41 RETVAL_PAPD=0
42 RETVAL_AFPD=0
43
44 # startup code for everything
45 atalk_startup() {
46     if [ x"${ATALKD_RUN}" != x"no" ]; then 
47         echo -n "  Starting atalkd:"
48         daemon ${ATALK_SBIN}/atalkd
49         RETVAL_ATALKD=$?
50         echo
51
52         if [ -x ${ATALK_BIN}/nbprgstr ]; then   
53             action "  Registering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${ATALK_BIN}/nbprgstr -p 4 \"${ATALK_NAME}:Workstation${ATALK_ZONE}\"
54             action "  Registering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${ATALK_BIN}/nbprgstr -p 4 \"${ATALK_NAME}:netatalk${ATALK_ZONE}\"
55         fi      
56
57         if [ x"${PAPD_RUN}" = x"yes"  -a -x ${ATALK_SBIN}/papd ]; then
58             echo -n "  Starting papd:"
59             daemon ${ATALK_SBIN}/papd
60             RETVAL_PAPD=$?
61             echo
62         fi
63
64         # check for timelord in bin directory
65         if [ x"${TIMELORD_RUN}" = x"yes"  -a -x ${ATALK_BIN}/timelord ]; then
66             echo -n "  Starting timelord"
67             daemon ${ATALK_BIN}/timelord
68             echo
69         fi
70
71         # check for timelord in sbin directory
72         if [ x"${TIMELORD_RUN}" = x"yes"  -a -x ${ATALK_SBIN}/timelord ]; then
73             echo -n "  Starting timelord"
74             daemon ${ATALK_SBIN}/timelord
75             echo
76         fi
77
78     fi
79
80     if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ] ; then
81             echo -n "  Starting afpd:"
82             daemon ${ATALK_SBIN}/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
83                -c ${AFPD_MAX_CLIENTS} -n \"${ATALK_NAME}${ATALK_ZONE}\"
84             RETVAL_AFPD=$?
85             echo
86     fi
87
88     if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_AFPD -eq 0 ]; then
89         RETVAL=0
90         touch /var/lock/subsys/atalk || RETVAL=1
91     fi
92 }
93
94 case "$1" in
95 'start')
96         echo -n 'Starting AppleTalk services: '
97         if [ x"${ATALK_BGROUND}" = x"yes" ]; then 
98             echo -n "(backgrounded)"
99             atalk_startup >& /dev/null &
100         else
101             echo
102             atalk_startup
103         fi
104         echo 
105         ;;
106 'stop')
107         echo 'Shutting down AppleTalk services: '
108         if [ x"${ATALKD_RUN}" != x"no" ]; then
109             if [ x"${PAPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/papd ]; then
110                 echo -n "  Stopping papd:"
111                 killproc papd
112                 RETVAL_PAPD=$?
113                 echo
114             fi
115
116             # checking for timelord in bin directory
117             if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_BIN}/timelord ]; then
118                 echo -n "  Stopping timelord:"
119                 killproc timelord
120                 echo
121             fi
122
123             # checking for timelord in sbin directory
124             if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/timelord ]; then
125                 echo -n "  Stopping timelord:"
126                 killproc timelord
127                 echo
128             fi
129
130             action "  Unregistering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${ATALK_BIN}/nbpunrgstr \"${ATALK_NAME}:Workstation${ATALK_ZONE}\"
131             action "  Unregistering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${ATALK_BIN}/nbpunrgstr \"${ATALK_NAME}:netatalk${ATALK_ZONE}\"
132
133             # kill atalkd last, since without it the plumbing goes away.
134             if [ -x ${ATALK_SBIN}/atalkd ]; then
135                 echo -n "  Stopping atalk:"
136                 killproc atalkd
137                 RETVAL_ATALKD=$?
138                 echo
139             fi
140         fi
141
142         # kill this separately as we also do AFP/tcp
143         if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ]; then
144             echo -n "  Stopping afpd:"
145             killproc afpd
146             RETVAL_AFPD=$?
147             echo
148         fi
149
150         if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_AFPD -eq 0 ] ; then
151             RETVAL=0
152             rm -f /var/lock/subsys/atalk || RETVAL=1
153         fi
154         echo ""
155         ;;
156   'restart'|'reload')
157         $0 stop
158         $0 start
159         RETVAL=$?
160         ;;
161   'status')
162         status atalkd
163         RETVAL=$?
164         ;;
165   *)
166         echo "Usage: atalk {start|stop|restart|status}"
167         exit 1
168 esac
169
170 exit $RETVAL