source: projects/specs/trunk/nonfree/self-build-minidlna/minidlna.init.d.script @ 11754

Revision 11754, 1.4 KB checked in by iwaim, 6 years ago (diff)

self-build-minidlna: add files

Line 
1#! /bin/sh
2
3# chkconfig: 345 98 16
4# description: Fedora Startup/shutdown script for MiniDLNA daemon
5
6# If you have chkconfig, simply:
7# chkconfig --add minildna
8
9# Proper init scripts on Linux systems normally require setting lock
10# and pid files under /var/run as well as reacting to network
11# settings, so you should treat this with care.
12
13# Original author:  Perry Clark <omfgppc (at) gmail.com>
14
15## EDIT FROM HERE
16
17# Installation details
18MINIDLNA="/usr/sbin/minidlnad"
19ARGS="/etc/minidlna/minidlna.conf"
20
21# Where to keep a log file
22MINIDLNA_LOG="/var/log/minidlna/minidlna.log"
23
24# Where the PID lives
25PID_FILE="/var/run/minidlnad.pid"
26
27## STOP EDITING HERE
28
29# The path that is to be used for the script
30PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
31
32set -e
33
34# Only start if we can find the minidlna.conf.
35test -x $MINIDLNA || exit 0
36
37# Parse command line parameters.
38case $1 in
39  start)
40        echo -n "Starting MiniDLNA: "
41        $MINIDLNA -f $ARGS -P $PID_FILE  >> $MINIDLNA_LOG 2>&1
42        echo "ok"
43        ;;
44
45  stop)
46        echo -n "Stopping MiniDLNA: "
47           for pidf in `/bin/ls $PID_FILE 2>/dev/null`; do
48            if [ -s $pidf ]; then
49                kill `cat $pidf` >/dev/null 2>&1
50            fi
51                        rm -rf $PIF_FILE
52           done
53        echo "ok"
54        ;;
55
56  restart|reload|force-reload)
57        echo "Restarting MiniDLNA: "
58       
59    $0 stop
60        sleep 2
61        $0 start
62       
63        ;;
64
65  *)
66        # Print help
67        echo "Usage: /etc/init.d/minidlna {start|stop|restart|reload|force-reload}"
68        exit 1
69        ;;
70esac
71
72exit 0
Note: See TracBrowser for help on using the repository browser.