diff options
Diffstat (limited to 'community/cdemu-daemon/cdemud.rc')
-rw-r--r-- | community/cdemu-daemon/cdemud.rc | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/community/cdemu-daemon/cdemud.rc b/community/cdemu-daemon/cdemud.rc new file mode 100644 index 000000000..c13fa6239 --- /dev/null +++ b/community/cdemu-daemon/cdemud.rc @@ -0,0 +1,56 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions +. /etc/conf.d/cdemud + +case "$1" in + start) + stat_busy "Loading vhba and loop modules" + modprobe loop + modprobe vhba + if [ $? -ne 0 ]; then + stat_fail + else + stat_done + fi + + stat_busy "Waiting for $CTL_DEVICE" + i=0 + until [ -c $CTL_DEVICE -o $i -ge 10 ]; do + i=`expr $i + 1` + sleep 1 + done + if [ -c $CTL_DEVICE ]; then + stat_done + else + stat_fail + fi + + stat_busy "Starting cdemud" + cdemud -d -n $NUM_DRIVES -c $CTL_DEVICE -a $AUDIO_BACKEND &>/dev/null + if [ $? -ne 0 ]; then + stat_fail + else + add_daemon cdemud + stat_done + fi + ;; + stop) + stat_busy "Stopping cdemud" + cdemud -k &>/dev/null + if [ $? -ne 0 ]; then + stat_fail + else + rm_daemon cdemud + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac |