Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/sh
- # chkconfig: 345 99 10
- # 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>
- # Edited by: David Gleich <wister.geo (at) yahoo.com>
- ## EDIT FROM HERE
- # Source function library.
- . /etc/rc.d/init.d/functions
- # Source networking configuration.
- . /etc/sysconfig/network
- # Installation details
- MINIDLNA="/usr/sbin/minidlna"
- ARGS="/etc/minidlna.conf"
- # Where to keep a log file
- MINIDLNA_LOG="/var/log/minidlna.log"
- # Where the PID & Lockfile lives
- PID_FILE="/var/run/minidlna.pid"
- LOCKFILE="/var/lock/subsys/minidlna"
- RETVAL=0
- ## 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
- RETVAL=$?
- [ $RETVAL -eq 0 ] && touch $LOCKFILE
- echo_success
- echo
- ;;
- stop)
- echo -n "Stopping MiniDLNA: "
- RETVAL=$?
- for pidf in `/bin/ls $PID_FILE 2>/dev/null`; do
- if [ -s $pidf ]; then
- kill `cat $pidf` >/dev/null 2>&1
- RETVAL=$?
- [ $RETVAL -eq 0 ] && echo_success
- [ $RETVAL -ne 0 ] && echo_failure
- fi
- rm -rf $PIF_FILE
- [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
- done
- echo
- ;;
- 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 $RETVAL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement