Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
fixup! Need to pass command to bash, apparently
Browse files Browse the repository at this point in the history
Apparently if you just use `$cmd`, it gets tokenized by spaces rather than
having quotes and backslashes and such interpreted as you might expect in
the shell. Since the mysql check commands are the first ones that have
spaces in the command, I need to change this to `bash -c "$cmd"`.
Apparently I had only tested the script with lms and such.

(The correct way to build up a command and run it is instead with arrays,
such as `"${cmd[@]}"`.)
  • Loading branch information
timmc-edx committed Oct 5, 2023
1 parent c9737ea commit 125f3db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ run_check() {
local cmd="$3"
echo "> $cmd"
set +e # Disable exit-on-error
if $cmd; then # Run the command itself and check if it succeeded.
if bash -c "$cmd"; then # Run the command itself and check if it succeeded.
succeeded="$succeeded $check_name"
else
docker compose logs --tail 30 "$service" # Just show recent logs, not all history
Expand Down

0 comments on commit 125f3db

Please sign in to comment.