wok view netatalk/stuff/etc/init.d/netatalk @ rev 19159

/etc/init.d/*: use 'action' in pair with 'status'.
'action' returns translated message, so why not to add full translatable /etc/init.d/* content
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu May 26 20:16:45 2016 +0300 (2016-05-26)
parents de266016c07c
children ff5fd8788cd9
line source
1 #!/bin/sh
2 # Start, stop and restart the netatalk deamons on SliTaz, at boot time or
3 # with the command line.
4 #
5 # To start netatalk at boot time, just put the right name in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
7 #
8 . /etc/init.d/rc.functions
10 NAME=atalkd
11 DESC="$(_ 'Netatalk daemons')"
12 PIDFILE=/var/run/$NAME.pid
13 AFPD_UAMLIST="-U uams_dhx.so,uams_clrtxt.so,uams_randnum.so"
14 AFPD_GUEST=nobody
15 AFPD_MAX_CLIENTS=50
16 ATALK_ZONE=
17 ATALK_NAME=$(hostname -s)
18 ATALK_BGROUND=no
20 . /etc/netatalk/netatalk.conf
22 # Start Netatalk servers.
23 atalk_startup()
24 {
25 if [ "$ATALKD_RUN" == "yes" ]; then
26 modprobe appletalk
27 atalkd
28 pidof atalkd > $PIDFILE
30 # register workstation
31 nbprgstr -p 4 "$ATALK_NAME:Workstation$ATALK_ZONE"
32 nbprgstr -p 4 "$ATALK_NAME:netatalk$ATALK_ZONE"
34 [ "$PAPD_RUN" == "yes" ] && papd
35 [ "$TIMELORD_RUN" == "yes" ] && timelord
36 fi
38 [ "$AFPD_RUN" = "yes" ] && afpd $AFPD_UAMLIST -g $AFPD_GUEST \
39 -c $AFPD_MAX_CLIENTS -n "$ATALK_NAME$ATALK_ZONE"
40 }
42 case "$1" in
43 start)
44 if active_pidfile $PIDFILE $NAME ; then
45 _ '%s is already running.' $NAME
46 exit 1
47 fi
48 action 'Starting %s: %s...' "$DESC" $NAME
49 if [ "$ATALK_BGROUND" == "yes" ]; then
50 atalk_startup >/dev/null &
51 else
52 atalk_startup
53 fi
54 status
55 ;;
56 stop)
57 if ! active_pidfile $PIDFILE $NAME ; then
58 _ '%s is not running.' $NAME
59 exit 1
60 fi
61 action 'Stopping %s: %s...' "$DESC" $NAME
62 killall afpd
63 killall papd
64 killall timelord
65 killall atalkd
66 status
67 ;;
68 restart)
69 $0 start
70 sleep 2
71 $0 stop
72 ;;
73 *)
74 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
75 newline
76 exit 1
77 ;;
78 esac
80 exit 0