PKGBUILDs/aur/netatalk/atalkd

53 lines
1.1 KiB
Text
Raw Normal View History

2011-01-27 02:03:22 +00:00
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
2012-04-15 16:58:08 +00:00
NAME="AppleTalk Protocol Daemon"
ARGS=
DEPENDS=init
REQUIRED="a2boot papd timelord"
DAEMON=`basename "$0"`
2011-01-27 02:03:22 +00:00
2012-04-15 16:58:08 +00:00
[ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON
PID=`get_pid $DAEMON`
2011-01-27 02:03:22 +00:00
2012-04-15 16:58:08 +00:00
get_pid_r() {
local pid=()
for i in $@
do j=`get_pid $i` || return 1;pid+=($j);done
echo ${pid[@]};
}
case "$1" in
start)
stat_busy "Starting $NAME"
[ `get_pid_r $DEPENDS` ] && [ -z "$PID" ] && $DAEMON $ARGS &>/dev/null
if [ $? = 0 ]; then
stat_done
else
stat_fail
if [ ! `get_pid_r $DEPENDS` ];then echo "Error: \"$DAEMON\" refusing to start, dependency \"$DEPENDS\" not met" >&2;fi
exit 1
fi
;;
stop)
stat_busy "Stopping $NAME"
[ ! `get_pid_r $REQUIRED` ] && [ -n "$PID" ] && kill $PID &>/dev/null
if [ $? = 0 ]; then
stat_done
else
stat_fail
if [ `get_pid_r $REQUIRED` ];then echo "Error: Dependency \"$REQUIRED\" requires \"$DAEMON\", stop it first" >&2;fi
exit 1
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac