blob: e8dab1f0891a576f596effabc19837f6acee6aa1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#!/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 vhba
if [ $? -ne 0 ]; then
stat_fail
else
stat_done
fi
stat_busy "Waiting for /dev/vhba_ctl"
i=0
until [ -c /dev/vhba_ctl -o $i -ge 10 ]; do
i=`expr $i + 1`
sleep 1
done
if [ -c /dev/vhba_ctl ]; then
stat_done
else
stat_fail
fi
stat_busy "Starting cdemud"
cdemud --ctl-device=/dev/vhba_ctl --bus=$BUS --num-devices=$NUM_DEVICES --audio-driver=$AUDIO_DRIVER --logfile=$LOG_FILE &
if [ $? -ne 0 ]; then
stat_fail
else
add_daemon cdemud
stat_done
fi
;;
stop)
stat_busy "Stopping cdemud"
kill -9 `pidof cdemud` &>/dev/null && sleep 1 && rmmod vhba
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
|