#! /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 ## EDIT FROM HERE # Installation details MINIDLNA="/usr/sbin/minidlnad" ARGS="/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" ## STOP EDITING HERE # 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 # Parse command line parameters. case $1 in start) echo -n "Starting MiniDLNA: " $MINIDLNA -f $ARGS -P $PID_FILE >> $MINIDLNA_LOG 2>&1 echo "ok" ;; stop) echo -n "Stopping MiniDLNA: " for pidf in `/bin/ls $PID_FILE 2>/dev/null`; do if [ -s $pidf ]; then kill `cat $pidf` >/dev/null 2>&1 fi rm -rf $PIF_FILE done echo "ok" ;; restart|reload|force-reload) echo "Restarting MiniDLNA: " $0 stop sleep 2 $0 start ;; *) # Print help echo "Usage: /etc/init.d/minidlna {start|stop|restart|reload|force-reload}" exit 1 ;; esac exit 0