summaryrefslogtreecommitdiff
path: root/system/watchdog
diff options
context:
space:
mode:
authorMenno Duursma <druiloor@zonnet.nl>2010-09-17 04:49:28 -0400
committerRobby Workman <rworkman@slackbuilds.org>2010-09-21 22:09:38 -0500
commitb0e9330a8bb8a7808a0459096ea0653a0f201d7c (patch)
treeb408b39b97b532e43036c0bb123e8ecb637ff99d /system/watchdog
parentf521bebc4ceb289fb95e940cdff0338969b2456d (diff)
downloadslackbuilds-b0e9330a8bb8a7808a0459096ea0653a0f201d7c.tar.gz
system/watchdog: Added (Linux watchdog timer daemon)
Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
Diffstat (limited to 'system/watchdog')
-rw-r--r--system/watchdog/README6
-rw-r--r--system/watchdog/README.SLACKWARE21
-rw-r--r--system/watchdog/config/rc.watchdog43
-rw-r--r--system/watchdog/doinst.sh23
-rw-r--r--system/watchdog/patches/watchdog-5.9-slackware.diff22
-rw-r--r--system/watchdog/slack-desc19
-rw-r--r--system/watchdog/watchdog.SlackBuild92
-rw-r--r--system/watchdog/watchdog.info10
8 files changed, 236 insertions, 0 deletions
diff --git a/system/watchdog/README b/system/watchdog/README
new file mode 100644
index 0000000000..04588c79f3
--- /dev/null
+++ b/system/watchdog/README
@@ -0,0 +1,6 @@
+Linux watchdog timer daemon
+
+This service periodically writes to /dev/watchdog - in the event
+of it _not_ being able to do so, Linux may reset the system.
+
+See also: README.SLACKWARE
diff --git a/system/watchdog/README.SLACKWARE b/system/watchdog/README.SLACKWARE
new file mode 100644
index 0000000000..8327e4357f
--- /dev/null
+++ b/system/watchdog/README.SLACKWARE
@@ -0,0 +1,21 @@
+For this to work, a kernel driver for the aformentioned device needs
+to be loaded. The module may be found in:
+ /lib/modules/`uname -r`/kernel/drivers/char/watchdog
+
+It can be configured to try and fix things (such as networking)
+before triggering a reboot. As 'repair.sh' may be able to do.
+See the examples included in /usr/doc/watchdog-5.6/examples
+
+This package also contains the 'wd_keepalive' program by Marcel Jansen
+which "can be run during critical periods when the normal watcdog
+shouldn't be run. It will read from the same configuration file;
+it will do no checks but will keep writing to the device.
+
+To enable the watchdog: make sure a kernel module gets loaded for it
+(at boot) such as the 'softdog' or an actual hardware driver...
+Then add the following to rc.local:
+
+# Start the watchdog timer deamon
+if [ -x /etc/rc.d/rc.watchdog ]; then
+ /etc/rc.d/rc.watchdog start
+fi
diff --git a/system/watchdog/config/rc.watchdog b/system/watchdog/config/rc.watchdog
new file mode 100644
index 0000000000..7e07dff61f
--- /dev/null
+++ b/system/watchdog/config/rc.watchdog
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# /etc/rc.d/rc.watchdog
+#
+# Start/stop/restart the watchdog timer service.
+
+watchdog_start() {
+ if [ ! -e /dev/watchdog ]; then
+ echo "$0: No /dev/watchdog device node seems to exist on this system."
+ echo "$0: A kernel module probably needs to be loaded; please see:"
+ echo "$0: /usr/src/linux/Documentation/watchdog/watchdog-api.txt"
+ exit 0
+ fi
+ if [ -x /usr/sbin/watchdog -a -r /etc/watchdog.conf ]; then
+ echo "Starting the watchdog timer service: /usr/sbin/watchdog"
+ /usr/sbin/watchdog
+ fi
+}
+
+watchdog_stop() {
+ killall watchdog
+}
+
+watchdog_restart() {
+ watchdog_stop
+ sleep 10 # can take a while to die
+ watchdog_start
+}
+
+case "$1" in
+'start')
+ watchdog_start
+ ;;
+'stop')
+ watchdog_stop
+ ;;
+'restart')
+ watchdog_restart
+ ;;
+*)
+ echo $"Usage: $0 {start|stop|restart}"
+esac
+
diff --git a/system/watchdog/doinst.sh b/system/watchdog/doinst.sh
new file mode 100644
index 0000000000..9d8334e29c
--- /dev/null
+++ b/system/watchdog/doinst.sh
@@ -0,0 +1,23 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+# Keep same perms on rc.watchdog:
+if [ -e etc/rc.d/rc.watchdog ]; then
+ cp -a etc/rc.d/rc.watchdog etc/rc.d/rc.watchdog.new.incoming
+ cat etc/rc.d/rc.watchdog.new > etc/rc.d/rc.watchdog.new.incoming
+ mv etc/rc.d/rc.watchdog.new.incoming etc/rc.d/rc.watchdog.new
+fi
+
+config etc/rc.d/rc.watchdog.new
+config etc/watchdog.conf.new
+
diff --git a/system/watchdog/patches/watchdog-5.9-slackware.diff b/system/watchdog/patches/watchdog-5.9-slackware.diff
new file mode 100644
index 0000000000..022d7b7394
--- /dev/null
+++ b/system/watchdog/patches/watchdog-5.9-slackware.diff
@@ -0,0 +1,22 @@
+--- watchdog-5.4.orig/examples/repair.sh 2006-07-30 05:50:06.000000000 -0500
++++ watchdog-5.9/examples/repair.sh 2008-03-02 12:58:08.086346303 -0600
+@@ -48,6 +48,9 @@
+ elif [ -x /etc/init.d/networking ]; then
+ # Debian
+ /etc/init.d/networking stop
++ elif [ -x /etc/rc.d/rc.inet1 ]; then
++ # Slackware
++ /etc/rc.d/rc.inet1 stop
+ else
+ ifconfig |
+ awk '/Link/ {print $1}' |
+@@ -79,6 +82,9 @@
+ elif [ -x /etc/rc.d/init.d/network ]; then
+ # Redhat
+ /etc/rc.d/init.d/network start
++elif [ -x /etc/rc.d/rc.inet1 ]; then
++ # Slackware
++ /etc/rc.d/rc.inet1 start
+ else
+ echo "Couldn't find network script to relaunch networking. Please edit $0" | logger -i -t repair -p daemon.info
+ exit $1
diff --git a/system/watchdog/slack-desc b/system/watchdog/slack-desc
new file mode 100644
index 0000000000..1a7557f1d5
--- /dev/null
+++ b/system/watchdog/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler-----------------------------------------------------|
+watchdog: watchdog (Linux watchdog timer daemon)
+watchdog:
+watchdog: This service periodically writes to /dev/watchdog - in the event
+watchdog: of it _not_ being able to do so; Linux may reset the system.
+watchdog:
+watchdog: It can be configured to try and fix things (such as networking)
+watchdog: before going about triggering reboot.
+watchdog:
+watchdog: The watchdog was written and is maintained by Michael Meskes
+watchdog: (based on example code by Alan Cox).
+watchdog:
diff --git a/system/watchdog/watchdog.SlackBuild b/system/watchdog/watchdog.SlackBuild
new file mode 100644
index 0000000000..3ce4c971ec
--- /dev/null
+++ b/system/watchdog/watchdog.SlackBuild
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+# Slackware build script for watchdog
+
+# Written by Menno Duursma <druiloor@zonnet.nl>
+
+# This program is free software. It comes without any warranty.
+# Granted WTFPL, Version 2, as published by Sam Hocevar. See
+# http://sam.zoy.org/wtfpl/COPYING for more details.
+
+PRGNAM=watchdog
+VERSION=${VERSION:-5.9}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e # Exit on most errors
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+chmod -R u+w,go+r-w,a-s .
+
+# Apply the Slackware support scripts patch
+patch -p1 --verbose < $CWD/patches/$PRGNAM-$VERSION-slackware.diff
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --docdir=/usr/doc/$PRGNAM-$VERSION \
+ --build=$ARCH-slackware-linux
+
+make
+make install-strip DESTDIR=$PKG
+
+# Move config to .new; let doinst.sh handle it further
+mv $PKG/etc/$PRGNAM.conf $PKG/etc/$PRGNAM.conf.new
+
+# Add init script too
+install -D -m755 $CWD/config/rc.$PRGNAM $PKG/etc/rc.d/rc.$PRGNAM.new
+
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a [A-Z][A-Z]* ChangeLog examples $PKG/usr/doc/$PRGNAM-$VERSION
+# Add the Debian doc for additional reference
+cp -a debian/README.debian $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/system/watchdog/watchdog.info b/system/watchdog/watchdog.info
new file mode 100644
index 0000000000..300b275874
--- /dev/null
+++ b/system/watchdog/watchdog.info
@@ -0,0 +1,10 @@
+PRGNAM="watchdog"
+VERSION="5.9"
+HOMEPAGE="http://sourceforge.net/projects/watchdog"
+DOWNLOAD="http://sourceforge.net/projects/watchdog/files/watchdog/5.9/watchdog-5.9.tar.gz"
+MD5SUM="d7cae3c9829f5d9a680764f314234867"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+MAINTAINER="Menno Duursma"
+EMAIL="druiloor@zonnet.nl"
+APPROVED="dsomero"