mirror of
https://github.com/mrworf/plexupdate.git
synced 2025-08-19 04:49:34 -07:00
Initial commit after cleaning up log
This commit is contained in:
parent
fa7ef1da94
commit
d97df36de3
3 changed files with 398 additions and 500 deletions
4
README.md
Normal file → Executable file
4
README.md
Normal file → Executable file
|
@ -74,9 +74,9 @@ Most of these options can be specified on the command-line as well, this is just
|
||||||
|
|
||||||
### Using it from CRON
|
### Using it from CRON
|
||||||
|
|
||||||
If you want to use plexupdate as either a cron job or as a [systemd job](https://github.com/mrworf/plexupdate/wiki/Running-plexupdate-daily-as-a-systemd-timer), the -c option should do what you want. All non-error exit codes will be set to 0 and no output will be printed to stdout unless something has actually been done. (a new version was downloaded, installed, etc)
|
Generally, you copy the cronwrapper from the extras folder into the ```/etc/cron.weekly``` and edit the script to suite your needs. It will require you to create a configuration file (or at least, it's highly recommended). It also provides logging via syslog if needed. Should the script fail, it will print why and in most cases, this will result in an email to you.
|
||||||
|
|
||||||
If you don't even want to know when something has been done, you can combine this with the -q option and you will only receive output in the event of an error. Everything else will just silently finish without producing any output.
|
[Also checkout the newly written wiki for more details]
|
||||||
|
|
||||||
### Command Line Options
|
### Command Line Options
|
||||||
|
|
||||||
|
|
41
extras/cronwrapper
Executable file
41
extras/cronwrapper
Executable file
|
@ -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
|
835
plexupdate.sh
835
plexupdate.sh
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue