]> arthur.barton.de Git - netatalk.git/blob - distrib/initscripts/rc.atalk.suse.tmpl
Update of the SuSE rc file by Hans-Peter Jansen.
[netatalk.git] / distrib / initscripts / rc.atalk.suse.tmpl
1 #! /bin/sh
2 # Copyright (c) 1996-2001 SuSE GmbH Nuernberg, Germany.  All rights reserved.
3 #
4 # Author: 
5 #       Reinhold Sojer, <reinhold@suse.de>
6 #       Olaf Hering, <olh@suse.de>
7
8 ### BEGIN INIT INFO
9 # Provides:       netatalk
10 # Required-Start: $network $named $remote_fs $netdaemons $syslog
11 # Required-Stop:
12 # Default-Start:  3 5
13 # Default-Stop:
14 # Description:    Appletalk TCP/IP daemons
15 ### END INIT INFO
16
17 test -f /etc/rc.config && {
18 . /etc/rc.config
19
20 # Determine the base and follow a runlevel link name.
21 base=${0##*/}
22 link=${base#*[SK][0-9][0-9]}
23
24 # Force execution if not called by a runlevel directory.
25 test $link = $base && START_ATALK=yes
26 test "$START_ATALK" = "yes" || exit 0
27
28 test -f /etc/rc.status && . /etc/rc.status
29 # The echo return value for success (defined in /etc/rc.config).
30 return=$rc_done
31 }
32
33 . :ETCDIR:/netatalk.conf
34
35 # startup code for everything
36 atalk_startup() {
37     if [ x"${ATALKD_RUN}" != x"no" ]; then 
38         echo -n "  Starting atalkd:"
39         :SBINDIR:/atalkd
40
41         if [ -x :BINDIR:/nbprgstr ]; then       
42             :BINDIR:/nbprgstr -p 4 `hostname|sed 's/\..*$//'`:Workstation
43             :BINDIR:/nbprgstr -p 4 `hostname|sed 's/\..*$//'`:netatalk
44
45         fi      
46
47         if [ x"${PAPD_RUN}" = x"yes"  -a -x :SBINDIR:/papd ]; then
48             echo -n "  Starting papd:"
49             :SBINDIR:/papd
50         fi
51
52         if [ x"${TIMELORD_RUN}" = x"yes"  -a -x :SBINDIR:/timelord ]; then
53             echo -n "  Starting timelord"
54             :SBINDIR:/timelord
55         fi
56
57     fi
58
59     if [ x"${AFPD_RUN}" = x"yes" -a -x :SBINDIR:/afpd ] ; then
60             echo -n "  Starting afpd:"
61             echo ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
62                -c ${AFPD_MAX_CLIENTS} -n ${ATALK_NAME}${ATALK_ZONE}
63             startproc :SBINDIR:/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
64                -c ${AFPD_MAX_CLIENTS} -n ${ATALK_NAME}${ATALK_ZONE}
65     fi
66
67         touch /var/lock/subsys/atalk 
68 }
69
70 case "$1" in
71     start)
72         if [ x"${ATALK_BGROUND}" = x"yes" ]; then 
73             echo "Starting netatalk in the background ... "
74             atalk_startup >& /dev/null &
75         else
76             echo "Starting netatalk (this may take a while) ..."
77             atalk_startup
78         fi
79         ;;
80     stop)
81         echo -n "Shutting down netatalk:"
82         killproc -TERM :SBINDIR:/papd
83         if test -x :SBINDIR:/timelord ; then
84           killproc -TERM :SBINDIR:/timelord
85         fi
86         killproc -TERM :SBINDIR:/atalkd
87         killproc -TERM :SBINDIR:/afpd
88         echo -e "$return"
89         ;;
90     restart|reload)
91         $0 stop && $0 start || return=$rc_failed
92         ;;
93     status)
94         echo -n "Checking for service atalk:"
95         checkproc :SBINDIR:/papd && echo -n "OK" || echo -n "No process"
96         checkproc :SBINDIR:/afpd && echo -n "OK" || echo "No process"
97         if test -x :SBINDIR:/timelord ; then
98           checkproc :SBINDIR:/timelord || return=$rc_failed
99         fi
100         checkproc :SBINDIR:/atalkd && echo "OK" || echo "No process"
101         ;;
102     *)
103         echo "Usage: $0 {start|stop|restart|status}"
104         exit 1
105         ;;
106 esac
107
108 # Inform the caller not only verbosely and set an exit status.
109 test "$return" = "$rc_done" || exit 1
110 exit 0
111