wok-current diff 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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netatalk-pam/stuff/etc/init.d/netatalk Mon Dec 23 22:28:27 2013 +0000 1.3 @@ -0,0 +1,81 @@ 1.4 +#!/bin/sh 1.5 +# Start, stop and restart the netatalk deamons on SliTaz, at boot time or 1.6 +# with the command line. 1.7 +# 1.8 +# To start netatalk at boot time, just put the right name in the $RUN_DAEMONS 1.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf. 1.10 +# 1.11 +. /etc/init.d/rc.functions 1.12 + 1.13 +NAME=atalkd 1.14 +DESC="netatalk deamons" 1.15 +PIDFILE=/var/run/$NAME.pid 1.16 +AFPD_UAMLIST="-U uams_dhx.so,uams_clrtxt.so,uams_randnum.so" 1.17 +AFPD_GUEST=nobody 1.18 +AFPD_MAX_CLIENTS=50 1.19 +ATALK_ZONE= 1.20 +ATALK_NAME=$(hostname -s) 1.21 +ATALK_BGROUND=no 1.22 + 1.23 +. /etc/netatalk/netatalk.conf 1.24 + 1.25 +# Start Netatalk servers. 1.26 +atalk_startup() 1.27 +{ 1.28 + if [ "$ATALKD_RUN" = "yes" ]; then 1.29 + modprobe appletalk 1.30 + atalkd 1.31 + pidof atalkd > $PIDFILE 1.32 + 1.33 + # register workstation 1.34 + nbprgstr -p 4 "$ATALK_NAME:Workstation$ATALK_ZONE" 1.35 + nbprgstr -p 4 "$ATALK_NAME:netatalk$ATALK_ZONE" 1.36 + 1.37 + [ "$PAPD_RUN" = "yes" ] && papd 1.38 + [ "$TIMELORD_RUN" = "yes" ] && timelord 1.39 + fi 1.40 + 1.41 + [ "$AFPD_RUN" = "yes" ] && afpd $AFPD_UAMLIST -g $AFPD_GUEST \ 1.42 + -c $AFPD_MAX_CLIENTS -n "$ATALK_NAME$ATALK_ZONE" 1.43 +} 1.44 + 1.45 +case "$1" in 1.46 +start) 1.47 + if active_pidfile $PIDFILE $NAME ; then 1.48 + echo "$NAME is already running." 1.49 + exit 1 1.50 + fi 1.51 + echo -n "Starting $DESC: $NAME... " 1.52 + if [ "$ATALK_BGROUND" == "yes" ]; then 1.53 + atalk_startup >/dev/null & 1.54 + else 1.55 + atalk_startup 1.56 + fi 1.57 + status 1.58 + ;; 1.59 +stop) 1.60 + if ! active_pidfile $PIDFILE $NAME ; then 1.61 + echo "$NAME is not running." 1.62 + exit 1 1.63 + fi 1.64 + echo -n "Stopping $DESC: $NAME... " 1.65 + killall afpd 1.66 + killall papd 1.67 + killall timelord 1.68 + killall atalkd 1.69 + status 1.70 + ;; 1.71 +restart) 1.72 + $0 start 1.73 + sleep 2 1.74 + $0 stop 1.75 + ;; 1.76 +*) 1.77 + echo "" 1.78 + echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" 1.79 + echo "" 1.80 + exit 1 1.81 + ;; 1.82 +esac 1.83 + 1.84 +exit 0