#!/bin/sh # # chkconfig: 345 60 00 ### BEGIN INIT INFO # Provides: cdemud # Required-Start: messagebus # Required-Stop: messagebus # Should-Start: dkms # Default-Start: 3 4 5 # Short-Description: CDEmu daemon # Description: Userspace daemon part of the userspace-cdemu suite. ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions DAEMON_NAME=cdemud DAEMON_PROCESS=cdemud DAEMON_BINARY=cdemud LOCK_FILE=/var/lock/subsys/$DAEMON_NAME RETVAL=0 OPTIONS= NUM_DEVICES= AUDIO= AUDIO_DEVICE= BUS= [ -f /etc/sysconfig/$DAEMON_NAME ] && . /etc/sysconfig/$DAEMON_NAME start() { [ -f $LOCK_FILE ] && return if ! /sbin/modprobe vhba; then echo "You need to install the vhba kernel module." RETVAL=1 return fi echo -n "Starting $DAEMON_NAME: " [ -n "$NUM_DEVICES" ] && OPTIONS="$OPTIONS -n $NUM_DEVICES" [ -n "$BUS" ] && OPTIONS="$OPTIONS -b $BUS" [ -n "$AUDIO" ] && OPTIONS="$OPTIONS -a $AUDIO" [ -n "$AUDIO_DEVICE" ] && OPTIONS="$OPTIONS -o $AUDIO_DEVICE" # redirected to null, otherwise outputs "Daemon returned 0." daemon $DAEMON_BINARY -d $OPTIONS 2>/dev/null RETVAL=$? echo [ $RETVAL -eq 0 ] && touch $LOCK_FILE } stop() { echo -n "Shutting down $DAEMON_NAME: " killproc $DAEMON_PROCESS RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE } case "$1" in start) start ;; stop) stop ;; status) status $DAEMON_PROCESS RETVAL=$? ;; reload) stop start ;; restart) stop start ;; condrestart) if [ -f $LOCK_FILE ]; then stop start fi ;; *) echo "Usage: $0 {start|stop|restart|reload|condrestart|status}" RETVAL=1 esac exit $RETVAL