SOURCES: ushare.init (NEW) - initial import

aredridel aredridel at pld-linux.org
Sun Dec 2 23:05:41 CET 2007


Author: aredridel                    Date: Sun Dec  2 22:05:41 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- initial import

---- Files affected:
SOURCES:
   ushare.init (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/ushare.init
diff -u /dev/null SOURCES/ushare.init:1.1
--- /dev/null	Sun Dec  2 23:05:41 2007
+++ SOURCES/ushare.init	Sun Dec  2 23:05:36 2007
@@ -0,0 +1,74 @@
+#!/bin/sh -e
+### BEGIN INIT INFO
+# Required-Start: $local_fs $syslog
+# Required-Stop:
+# Default-Start:  2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: start and stop ushare
+# Description: 
+### END INIT INFO
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/bin/ushare
+NAME=ushare
+DESC="uShare UPnP A/V Media Server"
+PIDFILE=/var/run/ushare.pid
+CONFIGFILE=/etc/ushare.conf
+
+# abort if no executable exists
+[ -x $DAEMON ] || exit 0
+
+# Get lsb functions
+. /lib/lsb/init-functions
+. /etc/default/rcS
+
+[ -f /etc/default/ushare ] && . /etc/default/ushare
+
+checkpid() {
+  [ -e $PIDFILE ] || touch $PIDFILE
+}
+
+check_shares() {
+  if [ -r "$CONFIGFILE" ]; then
+    . $CONFIGFILE
+    [ -n "$USHARE_DIR" ] && return 0
+  fi
+  return 1
+}
+
+case "$1" in
+  start)
+    log_daemon_msg "Starting $DESC: $NAME"
+    if ! $(check_shares); then
+      log_warning_msg "No shares avalaible ..."
+      log_end_msg 0
+    else
+      checkpid
+      start-stop-daemon --start --quiet --background --oknodo \
+        --make-pidfile --pidfile $PIDFILE \
+        --exec $DAEMON -- $USHARE_OPTIONS
+      log_end_msg $?
+    fi
+  ;;
+  stop)
+    log_daemon_msg "Stopping $DESC: $NAME"
+    start-stop-daemon --stop --signal 2 --quiet --oknodo --pidfile $PIDFILE
+    log_end_msg $?
+  ;;
+  reload|force-reload)
+    log_daemon_msg "Reloading $DESC: $NAME"
+    start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON
+    log_end_msg $?
+  ;;
+  restart)
+    $0 stop
+    $0 start
+  ;;
+  *)
+    N=/etc/init.d/$NAME
+    log_success_msg "Usage: $N {start|stop|restart|reload|force-reload}"
+    exit 1
+  ;;
+esac
+
+exit 0
================================================================


More information about the pld-cvs-commit mailing list