From 3dadedeb26b423a7c4b1de720d511c301265bd08 Mon Sep 17 00:00:00 2001 From: Will Woods Date: Tue, 10 Nov 2020 17:47:03 -0500 Subject: [PATCH] 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 --- roles/web-data-analysis/files/countme-update.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/roles/web-data-analysis/files/countme-update.sh b/roles/web-data-analysis/files/countme-update.sh index b51b51d429..ad94105693 100644 --- a/roles/web-data-analysis/files/countme-update.sh +++ b/roles/web-data-analysis/files/countme-update.sh @@ -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'"