forked from infra/ansible
web-data-analysis: export PATH in cron scripts for simple_message_to_bus
Cron jobs run with a stripped-down PATH (usually just /usr/bin:/bin), causing simple_message_to_bus (which resides in /usr/local/bin) to fail with "command not found" errors. This explicitly exports /usr/local/bin to the PATH at the top of the combineHttpLogs, condense-mirrorlogs, and countme update scripts so the message bus command executes properly. This also removes the redundant and late PATH assignments further down in the countme scripts. Fixes: #12833 Signed-off-by: Victor Koycheff <victorkoycheff@gmail.com>
This commit is contained in:
parent
62eff4cb2d
commit
a8f1cdfb5e
4 changed files with 7 additions and 12 deletions
|
|
@ -26,8 +26,7 @@ export MSGTOPIC_PREFIX=logging.stats
|
|||
export MSGBODY_PRESET="loghost=$(hostname) run_id=$(uuidgen -r)"
|
||||
|
||||
# simple_message_to_bus is in /usr/local/bin which isn't in the default path
|
||||
# Put it at the back, so it doesn't override anything.
|
||||
export PATH="$PATH:/usr/local/bin"
|
||||
export PATH="/usr/local/bin:$PATH"
|
||||
|
||||
simple_message_to_bus combinehttplogs.start
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
# We have dropped this down to 3 days on 2019-10-01
|
||||
|
||||
export PATH="/usr/local/bin:$PATH"
|
||||
|
||||
export MSGTOPIC_PREFIX=logging.stats
|
||||
export MSGBODY_PRESET="loghost=$(hostname) run_id=$(uuidgen -r)"
|
||||
simple_message_to_bus condense-mirrorlogs.start
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
export PATH="/usr/local/bin:$PATH"
|
||||
|
||||
# What are we called (used for message bus so don't just use cmd $0)
|
||||
CMD_NAME=countme-centos-update
|
||||
|
||||
|
|
@ -102,11 +104,6 @@ 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'"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
export PATH="/usr/local/bin:$PATH"
|
||||
|
||||
# What are we called (used for message bus so don't just use cmd $0)
|
||||
CMD_NAME=countme-update
|
||||
|
||||
|
|
@ -101,11 +103,6 @@ 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'"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue