mirror of
https://gitee.com/open-loongarch/buildroot-2024.08.git
synced 2026-10-29 06:27:14 +08:00
first commit: base 2024.08
Signed-off-by: maoxiaochuan <maoxiaochuan@loongson.cn>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# S95mpd Starts Music Player daemon.
|
||||
#
|
||||
# shellcheck disable=SC2317 # functions are called via variable
|
||||
|
||||
DAEMON="mpd"
|
||||
PIDFILE="/var/run/$DAEMON.pid"
|
||||
|
||||
# Sanity checks
|
||||
[ -f /etc/$DAEMON.conf ] || exit 0
|
||||
|
||||
start() {
|
||||
printf "Starting %s: " "$DAEMON"
|
||||
start-stop-daemon --start --pidfile "$PIDFILE" \
|
||||
--exec "/usr/bin/$DAEMON"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping %s: " "$DAEMON"
|
||||
start-stop-daemon --stop --pidfile "$PIDFILE" \
|
||||
--exec "/usr/bin/$DAEMON"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
# $DAEMON deletes its PID file on exit, wait for it to be gone
|
||||
while [ -f "$PIDFILE" ]; do
|
||||
sleep 0.1
|
||||
done
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|reload|restart)
|
||||
"$1"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|reload|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
Reference in New Issue
Block a user