-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit after cleaning up log
- Loading branch information
Showing
3 changed files
with
205 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
CONFIGURED=false | ||
|
||
CONF= | ||
SCRIPT=/home/john.doe/plexupdate/plexupdate.sh | ||
LOGGING=false | ||
|
||
if ! $CONFIGURED; then | ||
echo "ERROR: You have not configured this script" >&2 | ||
exit 255 | ||
fi | ||
|
||
if [ ! -z "$CONF" ]; then | ||
# We have a config file, prefix it with parameter | ||
CONF="--config \"${CONF}\"" | ||
fi | ||
|
||
LOGFILE=$(mktemp /tmp/plexupdate.cron.XXXX) | ||
|
||
RET=0 | ||
if $LOGGING; then | ||
"${SCRIPT}" "${CONF}" 2>&1 | tee ${LOGFILE} | logger -t plexupdate -p daemon.info | ||
if grep -q '^ERROR:' ${LOGFILE}; then | ||
RET=1 | ||
fi | ||
else | ||
"${SCRIPT}" "${CONF}" 2>&1 >${LOGFILE} | ||
RET=$? | ||
fi | ||
|
||
if [ $RET -ne 0 -a $RET -ne 2 -a $RET -ne 5 ]; then | ||
# Make sure user gets an email about this | ||
cat ${LOGFILE} >&2 | ||
else | ||
# Nah, not important | ||
RET=0 | ||
fi | ||
|
||
rm "${LOGFILE}" 2>/dev/null | ||
exit $RET |
Oops, something went wrong.