2011-01-27 02:03:22 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
. /etc/rc.conf
|
|
|
|
. /etc/rc.d/functions
|
2012-05-07 01:58:33 +00:00
|
|
|
. /etc/rc.d/netatalk common
|
2011-01-27 02:03:22 +00:00
|
|
|
|
2012-04-15 16:58:08 +00:00
|
|
|
NAME="Apple Filing Protocol Daemon"
|
|
|
|
ARGS=
|
|
|
|
DEPENDS=cnid_metad
|
|
|
|
REQUIRED=
|
2012-05-07 01:58:33 +00:00
|
|
|
DAEMON=afpd
|
2012-04-15 16:58:08 +00:00
|
|
|
|
|
|
|
[ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON
|
|
|
|
|
|
|
|
PID=`get_pid $DAEMON`
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
stat_busy "Starting $NAME"
|
2012-05-07 01:58:33 +00:00
|
|
|
`get_pid_rd $DEPENDS` && [ -z "$PID" ] && $DAEMON $ARGS &>/dev/null
|
2012-04-15 16:58:08 +00:00
|
|
|
if [ $? = 0 ]; then
|
|
|
|
stat_done
|
|
|
|
else
|
|
|
|
stat_fail
|
2012-05-07 01:58:33 +00:00
|
|
|
if ! `get_pid_rd $DEPENDS`;then echo "Error: \"$DAEMON\" refusing to start, dependency \"$DEPENDS\" not met" >&2;fi
|
2012-04-15 16:58:08 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stat_busy "Stopping $NAME"
|
2012-05-07 01:58:33 +00:00
|
|
|
`get_pid_rr $REQUIRED` && [ -n "$PID" ] && kill $PID &>/dev/null
|
2012-04-15 16:58:08 +00:00
|
|
|
if [ $? = 0 ]; then
|
|
|
|
stat_done
|
|
|
|
else
|
|
|
|
stat_fail
|
2012-05-07 01:58:33 +00:00
|
|
|
if ! `get_pid_rr $REQUIRED`;then echo "Error: Dependency \"$REQUIRED\" requires \"$DAEMON\", stop it first" >&2;fi
|
2012-04-15 16:58:08 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
$0 stop
|
|
|
|
sleep 1
|
|
|
|
$0 start
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "usage: $0 {start|stop|restart}"
|
2012-05-07 01:58:33 +00:00
|
|
|
esac
|