diff options
author | Menno E. Duursma <druiloor@zonnet.nl> | 2010-05-11 15:18:47 +0200 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2010-05-11 15:18:47 +0200 |
commit | c47979e93069e98328bccad0a79806c3a6dca6ce (patch) | |
tree | 08d3580f078454e943d14cbfc813b0dbb682d532 /system | |
parent | 27da3ddf82316842257c38fad64e8b8309913a0d (diff) | |
download | slackbuilds-c47979e93069e98328bccad0a79806c3a6dca6ce.tar.gz |
system/watchdog: Initial import
Diffstat (limited to 'system')
-rw-r--r-- | system/watchdog/README | 29 | ||||
-rw-r--r-- | system/watchdog/doinst.sh | 29 | ||||
-rw-r--r-- | system/watchdog/slack-desc | 10 | ||||
-rw-r--r-- | system/watchdog/watchdog-5.3.1-slackware.diff | 83 | ||||
-rw-r--r-- | system/watchdog/watchdog.SlackBuild | 76 | ||||
-rw-r--r-- | system/watchdog/watchdog.info | 8 |
6 files changed, 235 insertions, 0 deletions
diff --git a/system/watchdog/README b/system/watchdog/README new file mode 100644 index 0000000000..c5732210bc --- /dev/null +++ b/system/watchdog/README @@ -0,0 +1,29 @@ +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. + +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. See the examples included in: + /usr/doc/watchdog-$VERSION/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. + +The watchdog was written and is maintained by Michael Meskes +(it is based on example code by Alan Cox). + +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/doinst.sh b/system/watchdog/doinst.sh new file mode 100644 index 0000000000..3cf6ace364 --- /dev/null +++ b/system/watchdog/doinst.sh @@ -0,0 +1,29 @@ +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... +} + +PRGNAM=watchdog + +# Keep same perms on the rc.$PRGNAM.new +if [ -e etc/rc.d/rc.$PRGNAM ]; then + cp -a etc/rc.d/rc.$PRGNAM etc/rc.d/rc.$PRGNAM.new.incoming + cat etc/rc.d/rc.$PRGNAM.new > etc/rc.d/rc.$PRGNAM.new.incoming + mv etc/rc.d/rc.$PRGNAM.new.incoming etc/rc.d/rc.$PRGNAM.new +else + # Default to executable + chmod 0755 etc/rc.d/rc.$PRGNAM.new +fi + +config etc/rc.d/rc.$PRGNAM.new +config etc/$PRGNAM.conf.new + diff --git a/system/watchdog/slack-desc b/system/watchdog/slack-desc new file mode 100644 index 0000000000..7614694f27 --- /dev/null +++ b/system/watchdog/slack-desc @@ -0,0 +1,10 @@ +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). diff --git a/system/watchdog/watchdog-5.3.1-slackware.diff b/system/watchdog/watchdog-5.3.1-slackware.diff new file mode 100644 index 0000000000..0b55f1ad15 --- /dev/null +++ b/system/watchdog/watchdog-5.3.1-slackware.diff @@ -0,0 +1,83 @@ +diff -urN watchdog-5.3.1.std/examples/repair.sh watchdog-5.3.1/examples/repair.sh +--- watchdog-5.3.1.std/examples/repair.sh 2007-02-22 11:49:16.000000000 +0100 ++++ watchdog-5.3.1/examples/repair.sh 2007-06-10 19:38:14.000000000 +0200 +@@ -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}' | +@@ -78,7 +81,10 @@ + /etc/init.d/networking start + elif [ -x /etc/rc.d/init.d/network ]; then + # Redhat +- /etc/rc.d/init.d/network start ++ /etc/rc.d/inet1 start ++elif [ -x /etc/rc.d/init.d/network ]; then ++ # Slackware ++ /etc/rc.d/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 -urN watchdog-5.3.1.std/rc.watchdog.slackware watchdog-5.3.1/rc.watchdog.slackware +--- watchdog-5.3.1.std/rc.watchdog.slackware 1970-01-01 01:00:00.000000000 +0100 ++++ watchdog-5.3.1/rc.watchdog.slackware 2007-06-10 19:38:14.000000000 +0200 +@@ -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: Probably here a kernel module 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 -urN watchdog-5.3.1.std/watchdog.conf watchdog-5.3.1/watchdog.conf +--- watchdog-5.3.1.std/watchdog.conf 2007-02-22 11:49:16.000000000 +0100 ++++ watchdog-5.3.1/watchdog.conf 2007-06-10 19:39:57.000000000 +0200 +@@ -15,6 +15,7 @@ + # To get the real size, check how large the pagesize is on your machine. + #min-memory = 1 + ++# An example (script) is provided as: examples/repair.sh + #repair-binary = /usr/sbin/repair + #test-binary = + #test-timeout = diff --git a/system/watchdog/watchdog.SlackBuild b/system/watchdog/watchdog.SlackBuild new file mode 100644 index 0000000000..6c4b326445 --- /dev/null +++ b/system/watchdog/watchdog.SlackBuild @@ -0,0 +1,76 @@ +#!/bin/sh + +# Slackware build script for watchdog +# Written by Menno E. Duursma <druiloor@zonnet.nl> + +# Exit on most errors +set -e + +PRGNAM=watchdog +VERSION=5.3.1 +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" +fi + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar -xzvf $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 +cat $CWD/$PRGNAM-$VERSION-slackware.diff | patch -p1 --verbose + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man + +# Compile the application and install it into the $PKG directory +make +make install-strip DESTDIR=$PKG + +# Compress man pages +( cd $PKG/usr/man + find . -type f -exec gzip -9 {} \; + for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done +) + +# Copy program documentation into the package +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 +# Also, include the SlackBuild script in the documentation directory +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README$TAG + +# Move config to .new; let doinst.sh handle it further +mv $PKG/etc/$PRGNAM.conf $PKG/etc/$PRGNAM.conf.new + +# Add init script too +mkdir -p $PKG/etc/rc.d +cat rc.$PRGNAM.slackware > $PKG/etc/rc.d/rc.$PRGNAM.new + +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.tgz diff --git a/system/watchdog/watchdog.info b/system/watchdog/watchdog.info new file mode 100644 index 0000000000..d27905f543 --- /dev/null +++ b/system/watchdog/watchdog.info @@ -0,0 +1,8 @@ +PRGNAM="watchdog" +VERSION="5.3.1" +HOMEPAGE="http://sourceforge.net/projects/watchdog" +DOWNLOAD="http://www.ibiblio.org/pub/Linux/system/daemons/watchdog/watchdog_5.3.1.tar.gz" +MD5SUM="ba97ddce396bfccd8d409bc3141d7ef4" +MAINTAINER="Menno E. Duursma" +EMAIL="druiloor@zonnet.nl" +APPROVED="rworkman" |