Linux-DVB-DVBT-Apps-QuartzPVR

 view release on metacpan or  search on metacpan

install/etc/init.d/quartzpvr-server  view on Meta::CPAN

	
	    if [ -z "${2:-}" ]; then
	        echo -n "$1:"
	        return
	    fi
	    
	    echo -n "$1: $2"
	}
fi


fn_exists get_status_of_proc
exists=$?
if [ ! "$exists" = 0 ]
then
	# Return LSB status
	get_status_of_proc () {
	    local pidfile daemon name status
	
	    pidfile=
	    OPTIND=1
	    while getopts p: opt ; do
	        case "$opt" in
	            p)  pidfile="$OPTARG";;
	        esac
	    done
	    shift $(($OPTIND - 1))
	
	    if [ -n "$pidfile" ]; then
	        pidfile="-p $pidfile"
	    fi
	    daemon="$1"
	    name="$2"
	
	    status="0"
	    pidofproc $pidfile $daemon >/dev/null || status="$?"
	    if [ "$status" = 0 ]; then
	        log_success_msg "$name is running"
	        return 0
	    #elif [ "$status" = 4 ]; then
	    #    log_failure_msg "could not access PID file for $name"
	    #    return $status
	    else
	        log_failure_msg "$name is not running"
	        return $status
	    fi
	}
fi

QPVR_USER=%PVR_USER%
QPVR_GROUP=%PVR_GROUP%

PIDDIR=/var/run/$QPVR_USER
SERVER_BIN=/usr/sbin/quartzpvr
PIDFILE=$PIDDIR/server.pid
test -x $SERVER_BIN || exit 5

if [ ! -d $PIDDIR ]
then
	mkdir $PIDDIR
	chown -R $QPVR_USER:$QPVR_GROUP $PIDDIR
fi

# See how we were called.
case "$1" in
  start)
		log_daemon_msg "Starting Quartz PVR" "QuartzPVR"
	
##		start_daemon -p $PIDFILE $SERVER_BIN
		start_daemon $SERVER_BIN
  		get_status_of_proc -p $PIDFILE $SERVER_BIN "QuartzPVR"
	;;
  stop)
  		log_daemon_msg "Stopping Quartz PVR" "QuartzPVR"
	
	    killproc -p $PIDFILE $SERVER_BIN 2>/dev/null
	    killall $SERVER_BIN 2>/dev/null
	
#		log_success_msg "$name has stopped"
  		get_status_of_proc -p $PIDFILE $SERVER_BIN "QuartzPVR"
	;;
  restart|reload)
        ## Stop the service and regardless of whether it was
        ## running or not, start it again.
        $0 stop
        $0 start
        ;;
  status)
  		log_daemon_msg "Checking Quartz PVR" "QuartzPVR"
  		get_status_of_proc -p $PIDFILE $SERVER_BIN "QuartzPVR"
        ;;
  *)
	echo "Usage: $0 {start|stop|status|restart}"
	exit 1
esac
exit 0



( run in 0.867 second using v1.01-cache-2.11-cpan-5511b514fd6 )