]> arthur.barton.de Git - netatalk.git/blob - distrib/initscripts/rc.atalk.suse.tmpl
4eee0794df1e1dcdf544e6ce1ec0328b82c91e4e
[netatalk.git] / distrib / initscripts / rc.atalk.suse.tmpl
1 #! /bin/sh
2 # Copyright (c) 1996-2001 S.u.S.E. GmbH Fuerth, Germany.  All rights reserved.
3 #
4 # Author: 
5 #       Reinhold Sojer, <reinhold@suse.de>
6 #       Olaf Hering, <olh@suse.de>
7
8 # adapted to 1.4.99 (at 00-11-15) : Thomas Schierle, <ts@visual-s.de>
9 # template changes 2001-02-14     : jeff <jeff@univrel.pr.uconn.edu>
10 # template changes 2001-11-16     : Daniel E. Lautenschleger, <bobo@bocklabs.wisc.edu>
11
12 . /etc/rc.config
13
14 test -f :ETCDIR:/netatalk.conf || exit 0
15
16 . :ETCDIR:/netatalk.conf
17
18 # Determine the base and follow a runlevel link name.
19 base=${0##*/}
20 link=${base#*[SK][0-9][0-9]}
21
22 # Force execution if not called by a runlevel directory.
23 test $link = $base && START_ATALK=yes
24 test "$START_ATALK" = "yes" || exit 0
25
26 # The echo return value for success (defined in /etc/rc.config).
27 return=$rc_done
28
29 # Startup code
30 atalk_startup() {
31     if [ x"${ATALKD_RUN}" != x"no" ]; then
32         echo -n "  Starting atalkd:"
33         :SBINDIR:/atalkd
34
35         if [ -x :BINDIR:/nbprgstr ]; then
36             :BINDIR:/nbprgstr -p 4 "${ATALK_NAME}:Workstation${ATALK_ZONE}"
37             :BINDIR:/nbprgstr -p 4 "${ATALK_NAME}:netatalk${ATALK_ZONE}"
38     
39         fi
40
41         if [ x"${PAPD_RUN}" = x"yes"  -a -x :SBINDIR:/papd ]; then
42             echo -n "  Starting papd:"
43             :SBINDIR:/papd
44         fi
45             
46         if [ x"${TIMELORD_RUN}" = x"yes"  -a -x :SBINDIR:/timelord ]; then
47             echo -n "  Starting timelord"
48             :SBINDIR:/timelord
49         fi
50           
51     fi   
52
53     if [ x"${AFPD_RUN}" = x"yes" -a -x :SBINDIR:/afpd ] ; then
54             echo -n "  Starting afpd:"
55             echo ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
56                -c ${AFPD_MAX_CLIENTS} -n ${ATALK_NAME}${ATALK_ZONE}
57             startproc :SBINDIR:/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
58                -c ${AFPD_MAX_CLIENTS} -n "${ATALK_NAME}${ATALK_ZONE}"
59     fi
60         
61         touch /var/lock/subsys/atalk
62 }
63
64 case "$1" in
65     start)
66         if [ x"${ATALK_BGROUND}" = x"yes" ]; then
67             echo "Starting netatalk in the background ... "
68             atalk_startup >& /dev/null &
69         else
70             echo "Starting netatalk (this may take a while) ..."
71             atalk_startup
72         fi
73         ;;
74     stop)
75         echo -n "Shutting down netatalk:"
76         killproc -TERM :SBINDIR:/papd
77         if test -x :SBINDIR:/timelord ; then
78           killproc -TERM :SBINDIR:/timelord
79         fi
80         killproc -TERM :SBINDIR:/atalkd
81         killproc -TERM :SBINDIR:/afpd
82         echo -e "$return"
83         ;;
84     restart|reload)
85         $0 stop && $0 start || return=$rc_failed
86         ;;
87     status)
88         echo -n "Checking for service atalk:"
89         checkproc :SBINDIR:/papd && echo -n "OK" || echo -n "No process"
90         checkproc :SBINDIR:/afpd && echo -n "OK" || echo "No process"
91         if test -x :SBINDIR:/timelord ; then
92           checkproc :SBINDIR:/timelord || return=$rc_failed
93         fi
94         checkproc :SBINDIR:/atalkd && echo "OK" || echo "No process"
95         ;;
96     *)   
97         echo "Usage: $0 {start|stop|restart|status}"
98         exit 1
99         ;;
100 esac
101
102 # Inform the caller not only verbosely and set an exit status.
103 test "$return" = "$rc_done" || exit 1
104 exit 0