wok-current view netatalk-pam/stuff/etc/init.d/netatalk @ rev 15712
connman: use pidof string if no .pid file
author | Richard Dunbar <mojo@slitaz.org> |
---|---|
date | Mon Dec 23 22:28:27 2013 +0000 (2013-12-23) |
parents | |
children | 7f188676b59c |
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 deamons"
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 echo "$NAME is already running."
46 exit 1
47 fi
48 echo -n "Starting $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 echo "$NAME is not running."
59 exit 1
60 fi
61 echo -n "Stopping $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 echo ""
75 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
76 echo ""
77 exit 1
78 ;;
79 esac
81 exit 0