diff options
| author | root <root@noname.(none)> | 2012-10-01 00:08:52 +0200 |
|---|---|---|
| committer | root <root@noname.(none)> | 2012-10-01 00:08:52 +0200 |
| commit | bae977a0c9e55356abd2cfbdc2759df0ceabcdf5 (patch) | |
| tree | f932b4bbe67b6341069f05a922904cd4a8982601 /shutdown-hooks | |
| download | vdr-scripttools-bae977a0c9e55356abd2cfbdc2759df0ceabcdf5.tar.gz vdr-scripttools-bae977a0c9e55356abd2cfbdc2759df0ceabcdf5.tar.bz2 | |
Initial import of croncheck, fskprotect, extrametadata and thumbnail
Diffstat (limited to 'shutdown-hooks')
| -rwxr-xr-x | shutdown-hooks/croncheck/croncheck | 43 |
1 files changed, 43 insertions, 0 deletions
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 |
