这是笔记本acpi模块开机起动的两个脚本,现附上:
acpi:
#!/bin/bash
#
# chkconfig: 2345 04 70
# description: Load modules for acpi for fan battery thermal and all \
# the informations you can get from your laptop
#Sources Functions
. /etc/rc.d/init.d/functions
MODULES="battery ac fan thermal button"
#EXIT
RETVAL=0
[[ -d /proc/acpi ]] || exit 1
function start () {
for mod in $MODULES;do
message="Loading ACPI module $mod:"
modprobe $mod 2>/dev/null >/dev/null
if [[ $? != 0 ]];then
message="$message failed"
RETVAL=1
else
message="$message successfull"
fi
logger -t "INIT" $message
done
}
function stop () {
for mod in $MODULES;do
modprobe -r $mod 2>/dev/null >/dev/null
done
}
function status() {
loaded=
gprintf "Modules Loaded: \n"
for mod in $MODULES;do
if grep -q "^$mod " /proc/modules;then
loaded="$loaded $mod"
fi
done
if [[ -n $loaded ]];then
for i in $loaded;do gprintf "\t\t\n" $i;done
else
gprintf "\t\tNothing\n"
RETVAL=1
fi
}
# see how we were called.
case "$1" in
start)
start
touch /var/lock/subsys/acpi
;;
stop)
stop
rm -f /var/lock/subsys/acpi
;;
status)
status
;;
restart)
stop
start
;;
*)
gprintf "*** Usage: devfsd {start|stop|status|restart|reload}\n"
exit 1
esac
exit 0
这是acpid----acpi daemon
#!/bin/bash
#
# /etc/rc.d/init.d/acpid
#
# Starts the acpi daemon
#
# chkconfig: 345 44 56
# description: Listen and dispatch ACPI events from the kernel
# processname: acpid
# Source function library.
. /etc/rc.d/init.d/functions
DAEMON=acpi
PROGNAME=${DAEMON}d
test -x /usr/sbin/$PROGNAME || exit 0
RETVAL=0
#
# See how we were called.
#
start() {
# Check if it is already running
if [ ! -f /var/lock/subsys/$PROGNAME ]; then
gprintf "Starting %s daemon: " "$DAEMON"
daemon /usr/sbin/$PROGNAME
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$PROGNAME
echo
fi
return $RETVAL
}