From bae977a0c9e55356abd2cfbdc2759df0ceabcdf5 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 1 Oct 2012 00:08:52 +0200 Subject: Initial import of croncheck, fskprotect, extrametadata and thumbnail --- shutdown-hooks/croncheck/croncheck | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 shutdown-hooks/croncheck/croncheck (limited to 'shutdown-hooks') diff --git a/shutdown-hooks/croncheck/croncheck b/shutdown-hooks/croncheck/croncheck new file mode 100755 index 0000000..f7f9607 --- /dev/null +++ b/shutdown-hooks/croncheck/croncheck @@ -0,0 +1,43 @@ +#!/bin/sh + +SPOOLDIR="/var/spool/cronceck" +TIMEFRAME=60 + + +F="$(basename "$0")" + +# We are /etc/cron.*/00000_croncheck +if [ "$(basename "$0")" = "00000_croncheck" ]; then + crontype="$(basename "$(dirname "$0")")" + mkdir -p "${SPOOLDIR}" + echo "${crontype}" > "${SPOOLDIR}/parts_${crontype}.run" +# We are /etc/cron.*/zzzzz_croncheck +elif [ "$(basename "$0")" = "zzzzz_croncheck" ]; then + crontype="$(basename "$(dirname "$0")")" + mkdir -p "${SPOOLDIR}" + rm -f "${SPOOLDIR}/parts_${crontype}.run" +# We are /usr/sbin/croncheck +elif [ "$(basename "$0")" = "croncheck" ]; then + crontype="$2" + mkdir -p "${SPOOLDIR}" + case "$1" in + start) + echo "${crontype}" > "${SPOOLDIR}/crontab_${crontype}.run" + ;; + stop) + rm -f "${SPOOLDIR}/crontab_${crontype}.run" + ;; + esac +# We are /etc/vdr/shutdown-hooks\S[\d][\d].croncheck +elif [ "${F#*.}" = "croncheck" ]; then + if [ -d "${SPOOLDIR}" ]; then + oldifs=$IFS + IFS=' +' + for file in $(find "${SPOOLDIR}" \( -type f -and -cmin -${TIMEFRAME} \) ); do + echo "ABORT_MESSAGE=\"cron '$(cat $file)' running\"" + exit 1 + done + IFS=$oldifs + fi +fi -- cgit v1.2.3