~ubuntu-branches/ubuntu/precise/netatalk/precise

« back to all changes in this revision

Viewing changes to distrib/initscripts/rc.atalk.cobalt

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Rittau
  • Date: 2004-01-19 12:43:49 UTC
  • Revision ID: james.westby@ubuntu.com-20040119124349-es563jbp0hk0ae51
Tags: upstream-1.6.4
ImportĀ upstreamĀ versionĀ 1.6.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# chkconfig: 345 91 35
 
4
# description: Starts and stops the atalk, afpd & papd daemons for
 
5
#              providing AppleTalk networking services.
 
6
#
 
7
 
 
8
# Source function library.
 
9
. /etc/rc.d/init.d/functions
 
10
 
 
11
# set lcd stuff up if necessary
 
12
if [ x"$LCD_STOP" = x"" ]; then
 
13
        LCD_STOP="/sbin/stoplcd"
 
14
fi
 
15
if [ x"$LCD_SWRITE" = x"" ]; then
 
16
        LCD_SWRITE="/sbin/swritelcd"
 
17
fi
 
18
 
 
19
# set up i18n stuff if necessary
 
20
if [ -x /usr/local/sbin/getmsg ]; then
 
21
        GETMSG=/usr/local/sbin/getmsg
 
22
        START_MSG1=atalkStart1
 
23
        START_MSG2=atalkStart2
 
24
        STOP_MSG1=atalkStop1
 
25
        STOP_MSG2=atalkStop2
 
26
else
 
27
        GETMSG=getmsg
 
28
        START_MSG1=atalk_start_1
 
29
        START_MSG2=atalk_start_2
 
30
        STOP_MSG1=atalk_stop_1
 
31
        STOP_MSG2=atalk_stop_2
 
32
fi
 
33
 
 
34
# Source networking configuration.
 
35
. /etc/sysconfig/network
 
36
 
 
37
test -x /usr/sbin/atalkd || exit 0
 
38
 
 
39
test -f /etc/atalk/netatalk.conf || exit 0
 
40
 
 
41
# read in netatalk configuration
 
42
. /etc/atalk/netatalk.conf
 
43
 
 
44
# Check that networking is up.
 
45
[ ${NETWORKING} = "no" ] && exit 0
 
46
 
 
47
# initialize return values
 
48
RETVAL=1
 
49
RETVAL_ATALKD=0
 
50
RETVAL_PAPD=0
 
51
RETVAL_AFPD=0
 
52
 
 
53
# startup code for everything
 
54
atalk_startup() {
 
55
    if [ x"${ATALKD_RUN}" != x"no" ]; then 
 
56
        daemon /usr/sbin/atalkd
 
57
        RETVAL_ATALKD=$?
 
58
 
 
59
        if [ -x /usr/bin/nbprgstr ]; then       
 
60
            /usr/bin/nbprgstr -p 4 "${ATALK_NAME}:Workstation${ATALK_ZONE}"
 
61
            /usr/bin/nbprgstr -p 4 "${ATALK_NAME}:netatalk${ATALK_ZONE}"
 
62
        fi      
 
63
            
 
64
        if [ x"${PAPD_RUN}" = x"yes"  -a -x /usr/sbin/papd ]; then
 
65
            daemon /usr/sbin/papd
 
66
            RETVAL_PAPD=$?
 
67
        fi
 
68
 
 
69
        if [ -x /usr/sbin/timelord ]; then
 
70
            daemon /usr/sbin/timelord
 
71
        fi
 
72
    fi
 
73
 
 
74
    if [ x"${AFPD_RUN}" = x"yes" -a -x /usr/sbin/afpd ] ; then
 
75
            daemon /usr/sbin/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
 
76
                -c ${AFPD_MAX_CLIENTS} -n "${ATALK_NAME}${ATALK_ZONE}"
 
77
            RETVAL_AFPD=$?
 
78
    fi
 
79
 
 
80
    if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_AFPD -eq 0 ]; then
 
81
        RETVAL=0
 
82
        touch /var/lock/subsys/atalk || RETVAL=1
 
83
    fi
 
84
}
 
85
 
 
86
case "$1" in
 
87
'start')
 
88
        LINE1=`$GETMSG $START_MSG1`
 
89
        LINE2=`$GETMSG $START_MSG2`
 
90
        $LCD_STOP
 
91
        $LCD_SWRITE "$LINE1" "$LINE2" &>/dev/null &
 
92
        echo -n 'Starting AppleTalk services: '
 
93
        if [ x"${ATALK_BGROUND}" = x"yes" ]; then 
 
94
            echo -n "(backgrounded)"
 
95
            atalk_startup >& /dev/null &
 
96
        else
 
97
            atalk_startup
 
98
        fi
 
99
        echo 
 
100
        touch /var/lock/subsys/atalk
 
101
        ;;
 
102
'stop')
 
103
        LINE1=`$GETMSG $STOP_MSG1`
 
104
        LINE2=`$GETMSG $STOP_MSG2`
 
105
        $LCD_STOP
 
106
        $LCD_SWRITE "$LINE1" "$LINE2" &>/dev/null &
 
107
        echo -n 'Shutting down AppleTalk services: '
 
108
        if [ x"${ATALKD_RUN}" != x"no" ]; then
 
109
            if [ x"${PAPD_RUN}" = x"yes" -a -x /usr/sbin/papd ]; then
 
110
                killproc papd
 
111
                RETVAL_PAPD=$?
 
112
            fi
 
113
 
 
114
            /usr/bin/nbpunrgstr "${ATALK_NAME}:Workstation${ATALK_ZONE}"
 
115
            /usr/bin/nbpunrgstr "${ATALK_NAME}:netatalk${ATALK_ZONE}"
 
116
 
 
117
            # kill atalkd last, since without it the plumbing goes away.
 
118
            if [ -x /usr/sbin/atalkd ]; then
 
119
                killproc atalkd
 
120
                RETVAL_ATALKD=$?
 
121
            fi
 
122
        fi          
 
123
 
 
124
        # kill this separately as we also do AFP/tcp
 
125
        if [ x"${AFPD_RUN}" = x"yes" -a -x /usr/sbin/afpd ]; then
 
126
            killproc afpd
 
127
            RETVAL_AFPD=$?
 
128
        fi
 
129
 
 
130
        if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_AFPD -eq 0 ] ; then
 
131
            RETVAL=0
 
132
            rm -f /var/lock/subsys/atalk || RETVAL=1
 
133
        fi
 
134
        echo ""
 
135
        ;;
 
136
  restart|reload)
 
137
        $0 stop
 
138
        $0 start
 
139
        ;;
 
140
  status)
 
141
        status atalkd
 
142
        ;;
 
143
  *)
 
144
        echo "Usage: atalk {start|stop|restart|status}"
 
145
        exit 1
 
146
esac
 
147
 
 
148
exit $RETVAL