PKGBUILDs/aur/minidlna-cvs/minidlna.rc.d.script

56 lines
1 KiB
Text
Raw Normal View History

#!/bin/sh
# chkconfig: 345 99 10
# description: Startup/shutdown script for MiniDLNA daemon
#
# $Id: minidlna.init.d.script,v 1.2 2009/07/02 00:33:15 jmaggard Exp $
# MiniUPnP project
# author: Thomas Bernard
# website: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
# Modified for Arch Linux
# Maintainer: ponsfoot <cabezon.hashimoto@gmail.com> 2010-01-20.
MINIDLNA=/usr/sbin/minidlna
ARGS='-f /etc/minidlna.conf'
PIDFILE=/var/run/minidlna.pid
test -f $MINIDLNA || exit 0
. /etc/rc.conf
. /etc/rc.d/functions
[[ -f $PIDFILE ]] && PID=`cat $PIDFILE`
case "$1" in
start)
stat_busy "Starting MiniDLNA Daemon"
[[ -z "$PID" ]] && $MINIDLNA $ARGS -P $PIDFILE
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon minidlna
stat_done
fi
;;
stop)
stat_busy "Stopping MiniDLNA Daemon"
[[ ! -z "&PID" ]] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon minidlna
stat_done
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0