]> arthur.barton.de Git - netatalk.git/blob - distrib/initscripts/rc.atalk.suse.tmpl
Merge 2-1
[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 $syslog
11 # Required-Stop:
12 # Default-Start:  3 5
13 # Default-Stop:
14 # Description:    AFP over TCP and legacy Appletalk 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 ATALK_NAME=`hostname|sed 's/\..*$//'`
34 ATALK_UNIX_CHARSET='LOCALE'
35 ATALK_MAC_CHARSET='MAC_ROMAN'
36
37 CNID_METAD_RUN=yes
38 AFPD_RUN=yes
39 AFPD_MAX_CLIENTS=20
40 AFPD_UAMLIST="-U uams_dhx.so,uams_dhx2.so"
41 AFPD_GUEST=nobody
42 CNID_CONFIG="-l log_note"
43
44 ATALKD_RUN=no
45 PAPD_RUN=no
46 TIMELORD_RUN=no
47 #A2BOOT_RUN=no
48 ATALK_ZONE=
49 ATALK_BGROUND=no
50
51
52 . :ETCDIR:/netatalk.conf
53
54 # startup code for everything
55 atalk_startup() {
56     if [ x"${ATALKD_RUN}" != x"no" ]; then 
57         echo -n "  Starting atalkd:"
58         :SBINDIR:/atalkd
59
60         if [ -x :BINDIR:/nbprgstr ]; then       
61             :BINDIR:/nbprgstr -p 4 ${ATALK_NAME}:Workstation
62             :BINDIR:/nbprgstr -p 4 ${ATALK_NAME}:netatalk
63
64         fi      
65
66         if [ x"${PAPD_RUN}" = x"yes"  -a -x :SBINDIR:/papd ]; then
67             echo -n "  Starting papd:"
68             :SBINDIR:/papd
69         fi
70
71         if [ x"${TIMELORD_RUN}" = x"yes"  -a -x :SBINDIR:/timelord ]; then
72             echo -n "  Starting timelord"
73             :SBINDIR:/timelord
74         fi
75
76     fi
77
78     if [ x"${CNID_METAD_RUN}" = x"yes" -a -x :SBINDIR:/cnid_metad ] ; then
79             echo -n "  Starting cnid_metad:"
80         startproc :SBINDIR:/cnid_metad $CNID_CONFIG
81     fi
82
83     if [ x"${AFPD_RUN}" = x"yes" -a -x :SBINDIR:/afpd ] ; then
84             echo -n "  Starting afpd:"
85             echo ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
86                -c ${AFPD_MAX_CLIENTS} -n ${ATALK_NAME}${ATALK_ZONE}
87             startproc :SBINDIR:/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
88                -c ${AFPD_MAX_CLIENTS} -n ${ATALK_NAME}${ATALK_ZONE}
89     fi
90
91         touch /var/lock/subsys/atalk 
92 }
93
94 case "$1" in
95     start)
96         if [ x"${ATALK_BGROUND}" = x"yes" -a x"${ATALKD_RUN}" != x"no" ]; then 
97             echo "Starting netatalk in the background ... "
98             atalk_startup >& /dev/null &
99         else
100             echo "Starting netatalk (this may take a while) ..."
101             atalk_startup
102         fi
103         ;;
104     stop)
105         echo -n "Shutting down netatalk:"
106         killproc -TERM :SBINDIR:/papd
107         if test -x :SBINDIR:/timelord ; then
108           killproc -TERM :SBINDIR:/timelord
109         fi        
110         killproc -TERM :SBINDIR:/atalkd
111         killproc -TERM :SBINDIR:/afpd
112         if test -x :SBINDIR:/cnid_metad ; then
113           killproc -TERM :SBINDIR:/cnid_metad
114         fi
115         echo -e "$return"
116         ;;
117     restart|reload)
118         $0 stop && $0 start || return=$rc_failed
119         ;;
120     status)
121         echo -n "Checking for service atalk:"
122         checkproc :SBINDIR:/papd && echo -n "OK" || echo -n "No process"
123         checkproc :SBINDIR:/afpd && echo -n "OK" || echo "No process"
124         if test -x :SBINDIR:/timelord ; then
125           checkproc :SBINDIR:/timelord || return=$rc_failed
126         fi
127         if test -x :SBINDIR:/cnid_metad ; then
128           checkproc :SBINDIR:/cnid_metad || return=$rc_failed
129         fi
130         checkproc :SBINDIR:/atalkd && echo "OK" || echo "No process"    
131         ;;
132     *)
133         echo "Usage: $0 {start|stop|restart|status}"
134         exit 1
135         ;;
136 esac
137
138 # Inform the caller not only verbosely and set an exit status.
139 test "$return" = "$rc_done" || exit 1
140 exit 0
141