#
# chkconfig: 345 85 15
#
-# description: Saves sound mixer's settings on system shutdown and restores
+# description: Saves sound mixer's settings on system shutdown and restores \
# them on system startup.
# Source function library
[ -f /etc/sysconfig/aumix ] && . /etc/sysconfig/aumix
-RETVAL=0
-# See how we were called.
-case "$1" in
- start)
- # Check if the service is already running?
+start() {
if [ ! -f /var/lock/subsys/aumix ]; then
show "Setting up sound card mixer"
busy
else
nls "Sound card mixer is already set up"
fi
- ;;
- stop)
+}
+
+stop() {
if [ -f /var/lock/subsys/aumix ]; then
show "Saving sound card mixer's settings"
busy
ok
else
nls "Sound card mixer hasn't been set up"
- fi
+ fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ start
;;
- restart|force-reload)
- $0 stop
- $0 start
- exit $0
+ try-restart)
+ if [ -f /var/lock/subsys/aumix ]; then
+ stop
+ start
+ else
+ nls "Sound card mixer hasn't been set up"
+ fi
;;
save)
run_cmd "Saving sound card mixer's settings" aumix -f /etc/aumixrc -S
;;
- restore|reload)
+ restore|reload|force-reload)
show "Setting up sound card mixer"
busy
aumix -f /etc/aumixrc -L >/dev/null
- ok
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && ok || fail
;;
status)
cat /proc/devices | grep -q "\(sparcaudio\|sound\)"
else
nls "Monolithic sound card detected."
fi
-
+
cat /dev/sndstat 2> /dev/null | grep -A 1 "Midi devices:" | grep -q [0-9]:
if [ $? = 0 ]; then
nls "MIDI device present."
fi
;;
*)
- msg_usage "$0 {start|stop|restart|reload|force-reload|save|restore|status}"
+ msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|save|restore|status}"
exit 3
esac