#!/bin/bash # # hdpas This shell script takes care of starting and stopping # hdapsd, the ThinkPad Active Protection System daemon. # # (c) 2006 Mario Pascucci (ilpettegolo (a) yahoo it) # # chkconfig: - 15 80 # description: Active Protection System for Linux and ThinkPad notebooks. # Source function library. . /etc/init.d/functions # not configured, or broken installation [ ! -f /etc/sysconfig/hdapsconf ] && exit 0 # Source hdapsd configuration. . /etc/sysconfig/hdapsconf RETVAL=0 prog="hdapsd" start() { # checks for hdaps module if [ ! -f /sys/devices/platform/hdaps/position ]; then /sbin/modprobe hdaps res=$? if [ "$res" -ne 0 ]; then echo "No APS module found, exiting..." exit 1 fi fi # Start daemon. echo -n $"Starting hdAPSd: " daemon /usr/local/sbin/hdapsd -b -d $DEVICE -s $SENS RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/hdapsd return $RETVAL } stop() { echo -n $"Shutting down hdAPSd: " killproc hdapsd RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/hdapsd return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status hdapsd RETVAL=$? ;; restart|reload) stop start RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|status}" exit 1 esac exit $RETVAL