123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- #! /bin/sh
- # chkconfig: 345 98 16
- # description: Fedora Startup/shutdown script for MiniDLNA daemon
- # If you have chkconfig, simply:
- # chkconfig --add minildna
- # Proper init scripts on Linux systems normally require setting lock
- # and pid files under /var/run as well as reacting to network
- # settings, so you should treat this with care.
- # Original author: Perry Clark <omfgppc (at) gmail.com>
- # modified by IWAI, Masaharu <iwaim.sub@gmail.com>
- # Source function library.
- . /etc/rc.d/init.d/functions
- if [ -f /etc/sysconfig/minidlna ]; then
- . /etc/sysconfig/minidlna
- fi
- RETVAL=0
- LOCK_FILE=/var/lock/subsys/minidlna
- # Installation details
- MINIDLNA="/usr/sbin/minidlnad"
- CONF="/etc/minidlna/minidlna.conf"
- # Where to keep a log file
- MINIDLNA_LOG="/var/log/minidlna/minidlna.log"
- # Where the PID lives
- PID_FILE="/var/run/minidlnad.pid"
- # The path that is to be used for the script
- PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
- set -e
- # Only start if we can find the minidlna.conf.
- test -x $MINIDLNA || exit 0
- start() {
- echo -n "Starting MiniDLNA: "
- $MINIDLNA -f $CONF -P $PID_FILE >> $MINIDLNA_LOG 2>&1
- RETVAL=$?
- [ $RETVAL -eq 0 ] && success || failure
- echo
- [ $RETVAL -eq 0 ] && touch $LOCK_FILE
- return $RETVAL
- }
- stop() {
- pid=0
- if [ -f $PID_FILE ]; then
- pid=`cat $PID_FILE`
- echo -n "Stopping MiniDLNA: "
- kill $pid
- RETVAL=$?
- [ $RETVAL -eq 0 ] && success || failure
- echo
- [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
- return $RETVAL
- fi
- }
- # Parse command line parameters.
- case $1 in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart|reload|force-reload)
- echo "Restarting MiniDLNA: "
-
- stop
- sleep 2
- start
-
- ;;
- *)
- # Print help
- echo "Usage: /etc/init.d/minidlna {start|stop|restart|reload|force-reload}"
- exit 1
- ;;
- esac
- exit $?
|