. /etc/rc.d/init.d/functions
if [ ! -f /proc/apm ]; then
- modprobe apm && echo "No kernel APM support!"; exit 1
+ modprobe apm && nls "No kernel APM support!"; exit 1
fi
CONFIG=/etc/sysconfig/apmd
# See how we were called.
case "$1" in
start)
- msg_starting APM
- [ -r "$CONFIG" ] && . "$CONFIG"
- daemon /usr/sbin/apmd "$APMD_OPTIONS"
- touch /var/lock/subsys/apmd
+ # Check if the service is already running?
+ if [ ! -f /var/lock/subsys/apmd ]; then
+ msg_starting APM
+ [ -r "$CONFIG" ] && . "$CONFIG"
+ daemon apmd "$APMD_OPTIONS"
+ touch /var/lock/subsys/apmd
+ else
+ msg_already_running APM
+ exit 1
+ fi
;;
stop)
- msg_stopping APM
- killproc apmd
- rm -f /var/lock/subsys/apmd
+ if [ -f /var/lock/subsys/apmd ]; then
+ msg_stopping APM
+ killproc apmd
+ rm -f /var/lock/subsys/apmd
+ else
+ msg_not_running APM
+ exit 1
+ fi
;;
status)
status apmd
$0 start
;;
*)
- msg_usage "$0 {start|stop|status|restart|reload}"
+ msg_usage "$0 {start|stop|restart|reload|status}"
exit 1
esac