summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--powerd.init74
1 files changed, 74 insertions, 0 deletions
diff --git a/powerd.init b/powerd.init
new file mode 100644
index 0000000..1397827
--- /dev/null
+++ b/powerd.init
@@ -0,0 +1,74 @@
+#! /bin/sh
+#
+# pwerdd Start/Stop James Brents power daemon.
+#
+# chkconfig: 345 75 65
+# description: The power daemon provides a means of determining when the
+# power is off, wether through a serial port connected on
+# this machine, or a remote server, and allows the safe
+# shutdown of the machine.
+# processname: powerd
+# pidfile: /var/run/powerd.pid
+# config: /etc/powerd.conf
+
+# Source function library.
+. /etc/init.d/functions
+
+# Get config.
+. /etc/sysconfig/network
+
+# Check that networking is up.
+if [ ${NETWORKING} = "no" ]
+then
+ exit 0
+fi
+
+[ -x /usr/sbin/powerd ] || exit 0
+
+RETVAL=0
+
+start() {
+ echo -n "Starting powerd: "
+ daemon powerd
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/powerd
+ return $RETVAL
+}
+
+stop() {
+ echo -n "Stopping powerd services: "
+ killproc powerd
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/powerd
+ return $RETVAL
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ status powerd
+ ;;
+ restart|reload)
+ stop
+ start
+ ;;
+ condrestart)
+ if [ -f /var/lock/subsys/powerd ]; then
+ stop
+ start
+ fi
+ ;;
+ *)
+ echo "Usage: powerd {start|stop|status|restart|reload|condrestart}"
+ exit 1
+esac
+
+exit $RETVAL