mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-08 22:45:43 +00:00
47 lines
969 B
Bash
47 lines
969 B
Bash
#!/bin/bash
|
|
|
|
. /etc/rc.conf
|
|
. /etc/rc.d/functions
|
|
. /etc/rc.d/netatalk common
|
|
|
|
NAME="AppleTalk Time Daemon"
|
|
ARGS=
|
|
DEPENDS=atalkd
|
|
REQUIRED=
|
|
DAEMON=timelord
|
|
|
|
[ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON
|
|
|
|
PID=`get_pid $DAEMON`
|
|
|
|
case "$1" in
|
|
start)
|
|
stat_busy "Starting $NAME"
|
|
`get_pid_rd $DEPENDS` && [ -z "$PID" ] && $DAEMON $ARGS &>/dev/null
|
|
if [ $? = 0 ]; then
|
|
stat_done
|
|
else
|
|
stat_fail
|
|
if ! `get_pid_rd $DEPENDS`;then echo "Error: \"$DAEMON\" refusing to start, dependency \"$DEPENDS\" not met" >&2;fi
|
|
exit 1
|
|
fi
|
|
;;
|
|
stop)
|
|
stat_busy "Stopping $NAME"
|
|
`get_pid_rr $REQUIRED` && [ -n "$PID" ] && kill $PID &>/dev/null
|
|
if [ $? = 0 ]; then
|
|
stat_done
|
|
else
|
|
stat_fail
|
|
if ! `get_pid_rr $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
|