diff options
| author | Simon Rettberg | 2014-01-03 19:20:49 +0100 |
|---|---|---|
| committer | Simon Rettberg | 2014-01-03 19:20:49 +0100 |
| commit | 3e2c32e75c5e474b94ce80c2a43e81c10b2b4bd0 (patch) | |
| tree | c927bc41ab135857f3bdd125018a353bf8c79c03 | |
| parent | [pam] SLX_REMOTE_LOG_SESSIONS controls whether session open/close is logged, ... (diff) | |
| download | tm-scripts-3e2c32e75c5e474b94ce80c2a43e81c10b2b4bd0.tar.gz tm-scripts-3e2c32e75c5e474b94ce80c2a43e81c10b2b4bd0.tar.xz tm-scripts-3e2c32e75c5e474b94ce80c2a43e81c10b2b4bd0.zip | |
[cron] Add sendmail wrapper so it's possible to redirect mail output without recompiling
Also tweaked compilation a bit
| -rw-r--r-- | remote/modules/cron/cron.build | 12 | ||||
| -rwxr-xr-x | remote/modules/cron/data/opt/openslx/scripts/cron-sendmail | 30 | ||||
| -rw-r--r-- | remote/modules/cron/vixie-cron-4.1-crondir-support.tgz | bin | 64529 -> 0 bytes | |||
| -rw-r--r-- | remote/modules/cron/vixie-cron-4.1-openslx.tgz | bin | 0 -> 45269 bytes |
4 files changed, 36 insertions, 6 deletions
diff --git a/remote/modules/cron/cron.build b/remote/modules/cron/cron.build index 2f18b138..fc364347 100644 --- a/remote/modules/cron/cron.build +++ b/remote/modules/cron/cron.build @@ -4,22 +4,22 @@ fetch_source() { # use our own patched source - local TARBALL="vixie-cron-4.1-crondir-support.tgz" + local TARBALL="vixie-cron-4.1-openslx.tgz" [ ! -e "${TARBALL}" ] && perror "${TARBALL} not found under ${MODULE_DIR}." mkdir "${MODULE_DIR}/src" || perror "Could not create ${MODULE_DIR}/src" - tar xvfz "${TARBALL}" -C "${MODULE_DIR}/src" || perror "Could not extract ${TARBALL} to ${MODULE_DIR}/src" + tar xfz "${TARBALL}" -C "${MODULE_DIR}/src" || perror "Could not extract ${TARBALL} to ${MODULE_DIR}/src" } build() { # compilation cd "${MODULE_DIR}/src" || perror "Could not cd to '${MODULE_DIR}/src'. Did fetch_source work?" - make || perror "Could not compile cron using 'make'." + make cron || perror "Could not compile cron using 'make'." - # installation - mkdir -p "${MODULE_BUILD_DIR}"/{usr/bin,usr/sbin} - DESTDIR="${MODULE_BUILD_DIR}" make install || perror "Could not 'make install' to ${MODULE_BUILD_DIR}" + # copy to build dir, since there are no shared libs linked in + mkdir -p "${MODULE_BUILD_DIR}/usr/sbin" + cp "$MODULE_DIR/src/cron" "$MODULE_BUILD_DIR/usr/sbin/" || perror "Could copy cron binary to ${MODULE_BUILD_DIR}" cd - &>/dev/null } diff --git a/remote/modules/cron/data/opt/openslx/scripts/cron-sendmail b/remote/modules/cron/data/opt/openslx/scripts/cron-sendmail new file mode 100755 index 00000000..3ce2a19d --- /dev/null +++ b/remote/modules/cron/data/opt/openslx/scripts/cron-sendmail @@ -0,0 +1,30 @@ +#!/bin/ash + +. /opt/openslx/config + +if [ "x$SLX_CRON_MAIL" = "xslxlog" ]; then + # slxlog handling - special case + TMP=$(mktemp) + cat > "$TMP" + + SUBJ=$(grep '^Subject: .*$' "$TMP" | cut -c 10-) + + if [ -n "$SUBJ" ]; then + slxlog "cron" "$SUBJ" "$TMP" + fi + + rm -f -- "$TMP" +elif [ -n "$SLX_CRON_MAIL" ] && [ -x "$SLX_CRON_MAIL" ]; then + # see if SLX_CRON_MAIL is a valid binary and use that + $SLX_CRON_MAIL $@ +elif which sendmail 2> /dev/null; then + # fallback to sendmail + sendmail $@ +elif which logger 2> /dev/null; then + # nothing worked, write to syslog if logger is present + TMP=$(mktemp /tmp/cron.XXXXXXXX) + cat > "$TMP" + chmod 0600 "$TMP" + logger "cron tried to mail, but no mailer found! Mail dumped to $TMP" +fi + diff --git a/remote/modules/cron/vixie-cron-4.1-crondir-support.tgz b/remote/modules/cron/vixie-cron-4.1-crondir-support.tgz Binary files differdeleted file mode 100644 index ca660f5d..00000000 --- a/remote/modules/cron/vixie-cron-4.1-crondir-support.tgz +++ /dev/null diff --git a/remote/modules/cron/vixie-cron-4.1-openslx.tgz b/remote/modules/cron/vixie-cron-4.1-openslx.tgz Binary files differnew file mode 100644 index 00000000..2a9929d4 --- /dev/null +++ b/remote/modules/cron/vixie-cron-4.1-openslx.tgz |
