summaryrefslogtreecommitdiff
path: root/recipes-support
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-support')
-rwxr-xr-xrecipes-support/softdog-mon/default52
-rwxr-xr-xrecipes-support/softdog-mon/init69
-rw-r--r--recipes-support/softdog-mon_0.1.bb33
3 files changed, 154 insertions, 0 deletions
diff --git a/recipes-support/softdog-mon/default b/recipes-support/softdog-mon/default
new file mode 100755
index 0000000..d507357
--- /dev/null
+++ b/recipes-support/softdog-mon/default
@@ -0,0 +1,52 @@
+# Monitor program will have 1 second granularity. Fixed.
+# All times are in seconds.
+
+ENABLED="YES"
+
+# Hardware watchdog is found first, which is watchdog0.
+WATCHDOGDEV=/dev/watchdog1
+
+# Nice value -20, is highest priority for a user program, 19 is lowest.
+NICE="-20"
+
+# Watchdog timeout in seconds
+TIMEOUT=60
+
+
+# Environment
+
+PIDFILE="/run/softdog-mon.pid"
+
+# How often to feed in seconds
+FEED=10
+
+# File is synchonously open/read/written/closed every 300 seconds
+FILESAMPLERATE=300
+
+# File to be read/written
+# If I/O hangs, the TIMEOUT value is the maximum seconds until we
+# reset the device.
+MONITORFILE=/media/card/.softdog_monitor
+
+# Minimum available system memory in bytes
+MINIMUM_AVAILABLE_MEM=3000000
+MINIMUM_FREEHIGH=0
+
+# Rate at which we sample available memory
+MEMSAMPLERATE=3
+
+# last samples saved
+MEMSAMPLES=100
+
+# maximum number of samples failed in last samples saved
+MEMFAILEDSAMPLES=20
+
+# Allow time for flash upgrade during shudown
+SHUTDOWNTIMEOUT=600
+
+export PIDFILE
+export FEED FILESAMPLERATE MONITORFILE
+export MINIMUM_AVAILABLE_MEM MINIMUM_FREEHIGH
+export MEMSAMPLERATE MEMSAMPLES MEMFAILEDSAMPLES
+export SHUTDOWNTIMEOUT
+
diff --git a/recipes-support/softdog-mon/init b/recipes-support/softdog-mon/init
new file mode 100755
index 0000000..a02ab1a
--- /dev/null
+++ b/recipes-support/softdog-mon/init
@@ -0,0 +1,69 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: softdog-mon
+# Required-Start: $remote_fs
+# Required-Stop: $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Advanced Power Management daemon
+### END INIT INFO
+
+# Source function library.
+. /etc/init.d/functions
+if [ -r /etc/default/softdog-mon ] ; then
+ . /etc/default/softdog-mon
+fi
+
+LOG="logger -s -t 'softdog-mon' -p"
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+[ -f /etc/default/rcS ] && . /etc/default/rcS
+[ -f /etc/default/softdog-mon ] && . /etc/default/softdog-mon
+
+if ! [[ -c $WATCHDOGDEV ]] ; then
+ $LOG daemon.err "ERROR: device \"$WATCHDOGDEV\" was not found"
+ exit 1
+fi
+
+if [[ -z $TIMEOUT ]] ; then
+ $LOG daemon.err "ERROR: timeout \"$TIMEOUT\" was not found"
+ exit 1
+fi
+
+# Use NICE of zero if not set.
+: ${NICE:=0}
+
+
+case "$1" in
+ start)
+ echo -n "Starting softdog monitor daemon: "
+ /usr/sbin/start-stop-daemon -N $NICE \
+ -S -x /usr/sbin/softdog-mon -- $WATCHDOGDEV $TIMEOUT
+ if [ $? = 0 ]; then
+ echo "softdog-mon."
+ else
+ echo "(failed.)"
+ fi
+ ;;
+ stop)
+ echo -n "Stopping softdog monitor daemon: "
+ /usr/sbin/start-stop-daemon -K \
+ -x /usr/sbin/softdog-mon
+ echo "softdog-mon."
+ ;;
+ status)
+ status /usr/sbin/softdog-mon;
+ exit $?
+ ;;
+ restart|force-reload)
+ $0 stop
+ $0 start
+ exit
+ ;;
+ *)
+ echo "Usage: /etc/init.d/softdog-mon {start|stop|status|restart|force-reload}"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/recipes-support/softdog-mon_0.1.bb b/recipes-support/softdog-mon_0.1.bb
new file mode 100644
index 0000000..5ddcf7c
--- /dev/null
+++ b/recipes-support/softdog-mon_0.1.bb
@@ -0,0 +1,33 @@
+DESCRIPTION = "MultiTech Softdog monitor"
+LICENSE = "MIT"
+RDEPENDS_${PN} += "kernel-module-softdog bash"
+
+inherit autotools
+
+inherit update-rc.d systemd
+
+INITSCRIPT_NAME = "${PN}"
+# should we ever stop?
+INITSCRIPT_PARAMS = "start 99 3 5 . stop 20 0 1 2 6 ."
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=30e3dd411ec20099cbf782f420ae7ec2"
+PR = "r0"
+SRCREV="${PV}"
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+PACKAGES =+ "${PN}-test"
+FILES_${PN}-test = "${sbindir}/hog"
+
+SRC_URI = "git://git.multitech.net/softdog-mon.git;protocol=git \
+ file://init \
+ file://default \
+"
+
+S = "${WORKDIR}/git"
+
+do_install_append() {
+ echo $(pwd)
+ install -d ${D}/${sysconfdir}/init.d
+ install -d ${D}/${sysconfdir}/default
+ install -m 0755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/${PN}
+ install ${WORKDIR}/default ${D}/${sysconfdir}/default/${PN}
+}