PKGBUILDs/aur/netatalk/netatalk
2012-04-15 12:58:08 -04:00

42 lines
No EOL
690 B
Bash

#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
NAME="NetATalk Meta-Daemon"
DAEMON=`basename "$0"`
RUNNING=()
STOPPED=()
[ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON
for i in atalkd papd timelord a2boot cnid_metad afpd
do
if [ `type -p $i` ]; then if [ `get_pid $i` ]; then RUNNING+=($i); else STOPPED+=($i); fi; fi
done
case "$1" in
start)
STARTING=''; rc.d start ${STOPPED[@]}
if [ $? = 0 ]; then
add_daemon $DAEMON
else
exit 1
fi
;;
stop)
for ((i=${#RUNNING[@]}-1; i>=0; i--));do rc.d stop ${RUNNING[$i]}; done
if [ $? = 0 ]; then
rm_daemon $DAEMON
else
exit 1
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac