web-data-analysis: fix countme-update

So it turns out that pip3 installs scripts to /usr/local/bin and cron
jobs don't have /usr/local/bin in the path.

This commit adds /usr/local/bin to PATH in countme-update.sh.

For Maximum Correctness we should probably get pip to tell us where it
installed countme-update-{rawdb,totals}.sh but this'll work just fine
as long as pip keeps installing scripts to /usr/bin or /usr/local/bin.

Signed-off-by: Will Woods <wwoods@redhat.com>
This commit is contained in:
Will Woods 2020-11-10 17:47:03 -05:00
parent 5ac17bc51a
commit 3dadedeb26

View file

@ -11,7 +11,7 @@ PUBLIC_DATA_DIR=/var/www/html/csv-reports/countme
PUBLIC_TOTALS_DB=$PUBLIC_DATA_DIR/totals.db
PUBLIC_TOTALS_CSV=$PUBLIC_DATA_DIR/totals.csv
# Names of the update commands (if not in $PATH..)
# Names of the update commands. They should be in PATH somewhere..
UPDATE_RAWDB=countme-update-rawdb.sh
UPDATE_TOTALS=countme-update-totals.sh
@ -71,6 +71,11 @@ if [ -d "$COUNTME_CHECKOUT" ]; then
PATH="$COUNTME_CHECKOUT:$COUNTME_CHECKOUT/scripts:$PATH"
fi
# Hardcoding /usr/local/bin here is hacky; should be pulled from pip, but
# parsing pip output is nontrivial, and my father always told me:
# "Son, life's too damn short write a RFC2822 parser in bash."
PATH="$PATH:/usr/local/bin"
# Check for required commands
command -v $UPDATE_RAWDB >/dev/null || die "can't find '$UPDATE_RAWDB'"
command -v $UPDATE_TOTALS >/dev/null || die "can't find '$UPDATE_TOTALS'"