wok-current annotate 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 |
rev | line source |
---|---|
pascal@13275 | 1 #!/bin/sh |
pascal@13275 | 2 # Start, stop and restart the netatalk deamons on SliTaz, at boot time or |
pascal@13275 | 3 # with the command line. |
pascal@13275 | 4 # |
pascal@13275 | 5 # To start netatalk at boot time, just put the right name in the $RUN_DAEMONS |
pascal@13275 | 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf. |
pascal@13275 | 7 # |
pascal@13275 | 8 . /etc/init.d/rc.functions |
pascal@13275 | 9 |
pascal@13275 | 10 NAME=atalkd |
pascal@13275 | 11 DESC="netatalk deamons" |
pascal@13275 | 12 PIDFILE=/var/run/$NAME.pid |
pascal@13275 | 13 AFPD_UAMLIST="-U uams_dhx.so,uams_clrtxt.so,uams_randnum.so" |
pascal@13275 | 14 AFPD_GUEST=nobody |
pascal@13275 | 15 AFPD_MAX_CLIENTS=50 |
pascal@13275 | 16 ATALK_ZONE= |
pascal@13275 | 17 ATALK_NAME=$(hostname -s) |
pascal@13275 | 18 ATALK_BGROUND=no |
pascal@13275 | 19 |
pascal@13275 | 20 . /etc/netatalk/netatalk.conf |
pascal@13275 | 21 |
pascal@13275 | 22 # Start Netatalk servers. |
pascal@13275 | 23 atalk_startup() |
pascal@13275 | 24 { |
pascal@13275 | 25 if [ "$ATALKD_RUN" = "yes" ]; then |
pascal@13275 | 26 modprobe appletalk |
pascal@13275 | 27 atalkd |
pascal@13275 | 28 pidof atalkd > $PIDFILE |
pascal@13275 | 29 |
pascal@13275 | 30 # register workstation |
pascal@13275 | 31 nbprgstr -p 4 "$ATALK_NAME:Workstation$ATALK_ZONE" |
pascal@13275 | 32 nbprgstr -p 4 "$ATALK_NAME:netatalk$ATALK_ZONE" |
pascal@13275 | 33 |
pascal@13275 | 34 [ "$PAPD_RUN" = "yes" ] && papd |
pascal@13275 | 35 [ "$TIMELORD_RUN" = "yes" ] && timelord |
pascal@13275 | 36 fi |
pascal@13275 | 37 |
pascal@13275 | 38 [ "$AFPD_RUN" = "yes" ] && afpd $AFPD_UAMLIST -g $AFPD_GUEST \ |
pascal@13275 | 39 -c $AFPD_MAX_CLIENTS -n "$ATALK_NAME$ATALK_ZONE" |
pascal@13275 | 40 } |
pascal@13275 | 41 |
pascal@13275 | 42 case "$1" in |
pascal@13275 | 43 start) |
pascal@13275 | 44 if active_pidfile $PIDFILE $NAME ; then |
pascal@13275 | 45 echo "$NAME is already running." |
pascal@13275 | 46 exit 1 |
pascal@13275 | 47 fi |
pascal@13275 | 48 echo -n "Starting $DESC: $NAME... " |
pascal@13275 | 49 if [ "$ATALK_BGROUND" == "yes" ]; then |
pascal@13275 | 50 atalk_startup >/dev/null & |
pascal@13275 | 51 else |
pascal@13275 | 52 atalk_startup |
pascal@13275 | 53 fi |
pascal@13275 | 54 status |
pascal@13275 | 55 ;; |
pascal@13275 | 56 stop) |
pascal@13275 | 57 if ! active_pidfile $PIDFILE $NAME ; then |
pascal@13275 | 58 echo "$NAME is not running." |
pascal@13275 | 59 exit 1 |
pascal@13275 | 60 fi |
pascal@13275 | 61 echo -n "Stopping $DESC: $NAME... " |
pascal@13275 | 62 killall afpd |
pascal@13275 | 63 killall papd |
pascal@13275 | 64 killall timelord |
pascal@13275 | 65 killall atalkd |
pascal@13275 | 66 status |
pascal@13275 | 67 ;; |
pascal@13275 | 68 restart) |
pascal@13275 | 69 $0 start |
pascal@13275 | 70 sleep 2 |
pascal@13275 | 71 $0 stop |
pascal@13275 | 72 ;; |
pascal@13275 | 73 *) |
pascal@13275 | 74 echo "" |
pascal@13275 | 75 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
pascal@13275 | 76 echo "" |
pascal@13275 | 77 exit 1 |
pascal@13275 | 78 ;; |
pascal@13275 | 79 esac |
pascal@13275 | 80 |
pascal@13275 | 81 exit 0 |