]> arthur.barton.de Git - netatalk.git/blob - distrib/initscripts/rc.atalk.redhat.tmpl
Makes files and comments refering to install or configure variables up to date
[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 # Source function library.
13 . /etc/rc.d/init.d/functions
14
15 # Source networking configuration.
16 . /etc/sysconfig/network
17
18 test -x :SBINDIR:/atalkd || exit 0
19
20 test -f :ETCDIR:/netatalk.conf || exit 0
21
22 # read in netatalk configuration
23 . :ETCDIR:/netatalk.conf
24
25 # Check that networking is up.
26 [ ${NETWORKING} = "no" ] && exit 0
27
28 # initialize return values
29 RETVAL=1
30 RETVAL_ATALKD=0
31 RETVAL_PAPD=0
32 RETVAL_AFPD=0
33
34 # startup code for everything
35 atalk_startup() {
36     if [ x"${ATALKD_RUN}" != x"no" ]; then 
37         daemon :SBINDIR:/atalkd
38         RETVAL_ATALKD=$?
39
40         if [ -x :BINDIR:/nbprgstr ]; then       
41             :BINDIR:/nbprgstr -p 4 "${ATALK_NAME}:Workstation${ATALK_ZONE}"
42             :BINDIR:/nbprgstr -p 4 "${ATALK_NAME}:netatalk${ATALK_ZONE}"
43         fi      
44
45         if [ x"${PAPD_RUN}" = x"yes"  -a -x :SBINDIR:/papd ]; then
46             daemon :SBINDIR:/papd
47             RETVAL_PAPD=$?
48         fi
49
50         # check for timelord in bin directory
51         if [ -x :BINDIR:/timelord ]; then
52             daemon :BINDIR:/timelord
53         fi
54
55         # check for timelord in sbin directory
56         if [ -x :SBINDIR:/timelord ]; then
57             daemon :SBINDIR:/timelord
58         fi
59
60     fi
61
62     if [ x"${AFPD_RUN}" = x"yes" -a -x :SBINDIR:/afpd ] ; then
63             daemon :SBINDIR:/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
64                 -c ${AFPD_MAX_CLIENTS} -n "${ATALK_NAME}${ATALK_ZONE}"
65             RETVAL_AFPD=$?
66     fi
67
68     if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_AFPD -eq 0 ]; then
69         RETVAL=0
70         touch /var/lock/subsys/atalk || RETVAL=1
71     fi
72 }
73
74 case "$1" in
75 'start')
76         echo -n 'Starting AppleTalk services: '
77         if [ x"${ATALK_BGROUND}" = x"yes" ]; then 
78             echo -n "(backgrounded)"
79             atalk_startup >& /dev/null &
80         else
81             atalk_startup
82         fi
83         echo 
84         ;;
85 'stop')
86         echo -n 'Shutting down AppleTalk services: '
87         if [ x"${ATALKD_RUN}" != x"no" ]; then
88             if [ x"${PAPD_RUN}" = x"yes" -a -x :SBINDIR:/papd ]; then
89                 killproc papd
90                 RETVAL_PAPD=$?
91             fi
92
93             # checking for timelord in bin directory
94             if [ -x :BINDIR:/timelord ]; then
95                 killproc timelord
96             fi
97
98             # checking for timelord in sbin directory
99             if [ -x :SBINDIR:/timelord ]; then
100                 killproc timelord
101             fi
102
103             :BINDIR:/nbpunrgstr "${ATALK_NAME}:Workstation${ATALK_ZONE}"
104             :BINDIR:/nbpunrgstr "${ATALK_NAME}:netatalk${ATALK_ZONE}"
105
106             # kill atalkd last, since without it the plumbing goes away.
107             if [ -x :SBINDIR:/atalkd ]; then
108                 killproc atalkd
109                 RETVAL_ATALKD=$?
110             fi
111         fi
112
113         # kill this separately as we also do AFP/tcp
114         if [ x"${AFPD_RUN}" = x"yes" -a -x :SBINDIR:/afpd ]; then
115             killproc afpd
116             RETVAL_AFPD=$?
117         fi
118
119         if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_AFPD -eq 0 ] ; then
120             RETVAL=0
121             rm -f /var/lock/subsys/atalk || RETVAL=1
122         fi
123         echo ""
124         ;;
125   'restart'|'reload')
126         $0 stop
127         $0 start
128         RETVAL=$?
129         ;;
130   'status')
131         status atalkd
132         RETVAL=$?
133         ;;
134   *)
135         echo "Usage: atalk {start|stop|restart|status}"
136         exit 1
137 esac
138
139 exit $RETVAL