SOURCES: tpctl.apmiser.init (NEW) - almost raw, needs review

havner havner at pld-linux.org
Sun Aug 13 13:54:09 CEST 2006


Author: havner                       Date: Sun Aug 13 11:54:09 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- almost raw, needs review

---- Files affected:
SOURCES:
   tpctl.apmiser.init (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/tpctl.apmiser.init
diff -u /dev/null SOURCES/tpctl.apmiser.init:1.1
--- /dev/null	Sun Aug 13 13:54:09 2006
+++ SOURCES/tpctl.apmiser.init	Sun Aug 13 13:54:04 2006
@@ -0,0 +1,69 @@
+#!/bin/sh
+#
+# apmiser      This shell script takes care of starting and stopping apmiser
+#
+# chkconfig:   2345 27 73
+# description: apmiser is used for monitoring system usage when on batteries, \
+#              scaling the CPU voltage down via tpctl when idle to save power.
+# pidfile:     /var/run/apmiser.pid
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+exec=/usr/sbin/apmiser
+lockfile=/var/lock/subsys/$prog
+
+start() {
+    msg_starting "apmiser"
+    retval=0
+    # Sanity checks.
+    /sbin/modprobe thinkpad >/dev/null 2>&1
+    for f in /dev/thinkpad /proc/apm; do
+        if [ ! -e $f ]; then
+            failure $"$f not available, startup"
+            retval=1
+        fi
+    done
+    if [ $retval -eq 0 ]; then
+        # Start daemons.
+        daemon $exec --daemon
+        retval=$?
+    fi
+    echo
+    [ $retval -eq 0 ] && touch $lockfile
+    return $retval
+}
+
+stop() {
+    # Stop daemons.
+    msg_stopping "apmiser"
+    killproc $prog
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && rm -f $lockfile
+    return $retval
+}
+
+restart() {
+    stop
+    start
+}
+
+# See how we were called.
+case "$1" in
+  start|stop|restart)
+    $1
+    ;;
+  reload|force-reload)
+    restart
+    ;;
+  condrestart|try-restart)
+    [ ! -f $lockfile ] || restart
+    ;;
+  status)
+    status $prog
+    ;;
+  *)
+    echo "Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}"
+    exit 3
+esac
================================================================


More information about the pld-cvs-commit mailing list