summaryrefslogtreecommitdiff
path: root/extra/watchdog
diff options
context:
space:
mode:
authorParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
committerParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
commit415856bdd4f48ab4f2732996f0bae58595092bbe (patch)
treeede2018b591f6dfb477fe9341ba17b9bc000fab9 /extra/watchdog
Tue Apr 5 14:26:38 UTC 2011
Diffstat (limited to 'extra/watchdog')
-rw-r--r--extra/watchdog/PKGBUILD44
-rw-r--r--extra/watchdog/watchdog.cf2
-rw-r--r--extra/watchdog/watchdog.sh44
3 files changed, 90 insertions, 0 deletions
diff --git a/extra/watchdog/PKGBUILD b/extra/watchdog/PKGBUILD
new file mode 100644
index 000000000..70ec8a57b
--- /dev/null
+++ b/extra/watchdog/PKGBUILD
@@ -0,0 +1,44 @@
+# $Id: PKGBUILD 111485 2011-02-27 10:22:27Z thomas $
+# Maintainer: Thomas Bächler <thomas@archlinux.org>
+
+pkgname=watchdog
+pkgver=5.9
+pkgrel=1
+pkgdesc="Watchdog daemon"
+arch=(i686 x86_64)
+url="http://sourceforge.net/projects/watchdog"
+license=('GPL')
+depends=('glibc')
+backup=(etc/watchdog.conf
+ etc/conf.d/watchdog
+ etc/conf.d/wd_keepalive)
+source=(http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.gz
+ watchdog.sh
+ watchdog.cf)
+md5sums=('d7cae3c9829f5d9a680764f314234867'
+ '854451f554718b55186599faaa8d85f6'
+ '01c1e2e13f515131180b4ebe9b8b7cc3')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ ./configure \
+ --prefix=/usr \
+ --mandir=/usr/share/man \
+ --sysconfdir=/etc \
+ --localstatedir=/var
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make install DESTDIR=${pkgdir}
+ for fil in watchdog wd_keepalive ; do
+ install -D -m755 ${srcdir}/watchdog.sh ${pkgdir}/etc/rc.d/${fil}
+ install -D -m644 ${srcdir}/watchdog.cf ${pkgdir}/etc/conf.d/${fil}
+ done
+
+ sed -i 's/watchdog/wd_keepalive/g' ${pkgdir}/etc/rc.d/wd_keepalive
+ sed -i 's/watchdog/wd_keepalive/g' ${pkgdir}/etc/conf.d/wd_keepalive
+ sed -i 's/Watchdog/Simple Watchdog/' ${pkgdir}/etc/rc.d/wd_keepalive
+}
diff --git a/extra/watchdog/watchdog.cf b/extra/watchdog/watchdog.cf
new file mode 100644
index 000000000..a33e1ea91
--- /dev/null
+++ b/extra/watchdog/watchdog.cf
@@ -0,0 +1,2 @@
+# watchdog configuration
+WATCHDOG_OPTIONS=""
diff --git a/extra/watchdog/watchdog.sh b/extra/watchdog/watchdog.sh
new file mode 100644
index 000000000..00d5078a9
--- /dev/null
+++ b/extra/watchdog/watchdog.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID="$( cat /var/run/watchdog.pid 2>/dev/null )"
+[ -r /etc/conf.d/watchdog ] && source /etc/conf.d/watchdog
+
+case "$1" in
+ start)
+ stat_busy "Starting Watchdog Daemon"
+
+ [ -z "$PID" ] && /usr/sbin/watchdog ${WATCHDOG_OPTIONS}
+
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon watchdog
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Watchdog Daemon"
+
+ [ -n "$PID" ] && kill $PID &> /dev/null
+
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon watchdog
+ stat_done
+ fi
+
+ rm -f /var/run/watchdog.pid
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0