#! /bin/sh # # $Id: xbmsp-rc,v 1.4 2003/03/14 01:45:55 tri Exp $ # DIR="-" RUNASUSER="nobody" #REMOTEPASS="xboxpassword" #LISTENINTERFACE="172.16.42.1" FOLLOWSYMLINKS=NO SERVERCOMMENT="Video and MP3 server by Bart. Watch and listen and ENJOY." # # The /. in the end of the share dir allows the share dir itself # to be a symbolic link. # SHARES="movies=/usr/movies/. audio=/usr/audio/." BIN="/bin/false" if test -d /var/run ; then PIDFILE=/var/run/ccxstream.pid else PIDFILE=/etc/ccxstream.pid fi PARAMS="-f -F $PIDFILE -r $DIR -u $RUNASUSER" if test "$FOLLOWSYMLINKS" == "YES" ; then PARAMS="$PARAMS -L" fi if test "x$REMOTEPASS" != "x" ; then PARAMS="$PARAMS -P $REMOTEPASS" fi if test "x$LISTENINTERFACE" != "x" ; then PARAMS="$PARAMS -l $LISTENINTERFACE" fi for i in $SHARES ; do PARAMS="$PARAMS -S $i" done for i in /usr/local/libexec /usr/local/sbin /usr/libexec /usr/sbin ; do if test -x "$i""/ccxstream" ; then BIN="$i""/ccxstream" break fi done if test "x$SERVERCOMMENT" = "x" ; then SERVERCOMMENT="`hostname`" fi rval=0 case "$1" in start_msg) echo "Start xbmsp server (ccxstream)" ;; stop_msg) echo "Stopping xbmsp server (ccxstream)" ;; start|'') "$BIN" $PARAMS -C "$SERVERCOMMENT" rval=$? echo -n " ccxstream" ;; stop) test -f "$PIDFILE" || exit 0 kill -TERM `cat "$PIDFILE"` rval=$? rm -f "$PIDFILE" echo " ccxstream" ;; restart) $0 stop $0 start rval=$? ;; status) test -f "$PIDFILE" || exit 1 cat "$PIDFILE" rval=$? ;; *) echo "Usage: $0 {start|stop|restart|status}" rval=1 esac exit $rval