summaryrefslogtreecommitdiffstats
path: root/source/n/netatalk/rc.atalk.new
blob: ce490345f69d1847cd4e51c93577c617e4a1a1fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#
# AppleTalk daemons. Make sure not to start atalkd in the background:
# its data structures must have time to stablize before running the
# other processes.
#

netatalk_start() {
  echo -n 'starting appletalk daemons: '
  if [ -x /usr/sbin/atalkd ]; then
    echo -n ' atalkd'
    /usr/sbin/atalkd
  fi
  if [ -x /usr/bin/nbprgstr ]; then
    echo -n ' nbprgstr'
    /usr/bin/nbprgstr -p 4 `hostname|sed 's/\..*$//'`:Workstation
    /usr/bin/nbprgstr -p 4 `hostname|sed 's/\..*$//'`:netatalk
  fi
  if [ -x /usr/sbin/papd ]; then
    echo -n ' papd'
    /usr/sbin/papd
  fi
  if [ -x /usr/sbin/afpd ]; then
    echo -n ' afpd'
    /usr/sbin/afpd
  fi
  if [ -x /usr/sbin/timelord ]; then
    echo -n ' timelord'
    /usr/sbin/timelord
  fi
  echo
}

netatalk_stop() {
  killall atalkd nbprgstr papd afpd timelord 2> /dev/null
}

netatalk_restart() {
  netatalk_stop
  sleep 1
  netatalk_start
}

case "$1" in
'start')
  netatalk_start
  ;;
'stop')
  netatalk_stop
  ;;
'restart')
  netatalk_restart
  ;;
*)
  netatalk_start
esac