]> git.pld-linux.org Git - packages/netatalk.git/blob - atalk.init
- formatting
[packages/netatalk.git] / atalk.init
1 #!/bin/sh
2 # chkconfig:    345 91 35
3 # description:  This package enables Linux to talk to Macintosh computers via the \
4 #               AppleTalk networking protocol. It includes a daemon to allow Linux \
5 #               to act as a file server over EtherTalk or IP for Mac's.
6 # processname: atalkd
7 # pidfile: /var/run/atalkd.pid
8 # config: /etc/atalk/*
9
10 # Source function library.
11 . /etc/rc.d/init.d/functions
12
13 # Source networking configuration.
14 . /etc/sysconfig/network
15
16 # Source Appletalk configuration
17 . /etc/sysconfig/netatalk
18
19 # Check that networking is up.
20 if is_yes "${NETWORKING}"; then
21         if [ ! -f /var/lock/subsys/network ]; then
22                 msg_network_down AppleTalk
23                 exit 1
24         fi
25 else
26         exit 0
27 fi
28
29 #check atalkd.conf exit
30 #[ -f /etc/atalk/atalkd.conf ] || exit 0
31
32 RETVAL=0
33 case "$1" in
34   start) 
35         if [ ! -f /var/lock/subsys/atalk ]; then
36                 _insmod single -f /lib/modules/`uname -r`/misc/appletalk.o
37                 if [ "$ATALK_BGROUND" = yes ]; then
38 #                       nls -n "(backgrounded)"
39                         msg_starting AppleTalk
40                         daemon atalkd
41                         nbprgstr -p 4 "${ATALK_NAME}:Workstation"
42                         nbprgstr -p 4 "${ATALK_NAME}:netatalk"
43                         if [ ${PAPD_RUN} = yes ]; then
44                                 msg_starting papd
45                                 daemon papd
46                         fi
47                         if [ ${AFPD_RUN} = yes ]; then
48                                 msg_starting afpd
49                                 daemon afpd -c ${AFPD_MAX_CLIENTS} -n ${ATALK_NAME}
50                         fi
51                         >/dev/null &
52                 fi
53         else
54                 msg_already_running AppleTalk
55         fi
56         touch /var/lock/subsys/atalk
57         ;;
58   stop) 
59         if [ -f /var/lock/subsys/atalk ]; then
60                 if [ "$ATALK_BGROUND" = yes ]; then
61                         msg_stopping afpd
62                         killproc afpd
63                         msg_stopping papd
64                         killproc papd
65                         nbpunrgstr "${ATALK_NAME}:Workstation@*"
66                         nbpunrgstr "${ATALK_NAME}:netatalk@*"
67                         msg_stopping AppleTalk
68                         killproc atalkd
69                 fi
70                 # Attempt to zap the module, so that we can restart the
71                 # Appletalk daemons cleanly
72                 if [ -e /proc/modules ] && [ -x /sbin/modprobe ]; then
73                         modprobe -r appletalk
74                 fi
75                 rm -f /var/lock/subsys/atalk >/dev/null 2>&1
76         else
77                 msg_not_running AppleTalk
78         fi
79         ;;
80   restart|force-reload)
81         $0 stop
82         $0 start
83         exit $?
84         ;;
85   status)
86         status atalkd
87         RETVAL=?
88         status papd
89         [ $RETVAL -eq 0 ] && RETVAL=?
90         status afpd
91         [ $RETVAL -eq 0 ] && RETVAL=?
92         ;;
93   *)
94         msg_usage "$0 {start|stop|restart|force-reload|status}"
95         exit 3
96 esac
97
98 exit $RETVAL
This page took 0.028149 seconds and 3 git commands to generate.