From 760ad2b564db520d06b726993e82539ba112d566 Mon Sep 17 00:00:00 2001 From: Alex Malinovich Date: Thu, 17 Nov 2016 20:53:36 -0800 Subject: [PATCH] Fixes for cronwrapper behavior (#138) * Fix cronwrapper failing if CONF is specified * Exit code 0 means an update was applied, so we should send output * Make sure wget log gets cleaned up along with other temp files * Fix cronwrapper showing unwanted output even while logging --- extras/cronwrapper | 6 +++--- plexupdate.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extras/cronwrapper b/extras/cronwrapper index 6315de2..67a5abf 100755 --- a/extras/cronwrapper +++ b/extras/cronwrapper @@ -39,7 +39,7 @@ if [ ! -z "$CONF" ]; then echo "ERROR: Cannot find config file (tried ${CONF})" >&2 exit 255 fi - CONF="--config \"${CONF}\"" + CONF="--config=${CONF}" fi LOGFILE=$(mktemp /tmp/plexupdate.cron.XXXX) @@ -51,11 +51,11 @@ if $LOGGING; then RET=1 fi else - "${SCRIPT}" "${CONF}" 2>&1 >${LOGFILE} + "${SCRIPT}" "${CONF}" >${LOGFILE} 2>&1 RET=$? fi -if [ $RET -ne 0 -a $RET -ne 2 -a $RET -ne 5 ]; then +if [ $RET -ne 2 -a $RET -ne 5 ]; then # Make sure user gets an email about this cat ${LOGFILE} >&2 else diff --git a/plexupdate.sh b/plexupdate.sh index 4fd2c78..a160549 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -192,7 +192,7 @@ keypair() { # Setup an exit handler so we cleanup cleanup() { - for F in "${FILE_RAW}" "${FILE_FAILCAUSE}" "${FILE_POSTDATA}" "${FILE_KAKA}" "${FILE_SHA}" "${FILE_LOCAL}" "${FILE_REMOTE}"; do + for F in "${FILE_RAW}" "${FILE_FAILCAUSE}" "${FILE_POSTDATA}" "${FILE_KAKA}" "${FILE_SHA}" "${FILE_LOCAL}" "${FILE_REMOTE}" "${FILE_WGETLOG}"; do rm "$F" 2>/dev/null >/dev/null done }