Skip to content

Commit

Permalink
fix(scripts/install.sh): improve install failure detection
Browse files Browse the repository at this point in the history
  • Loading branch information
swiatekm committed Feb 28, 2024
1 parent ea98d92 commit 54e233a
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1947,9 +1947,20 @@ if [[ "${OS_TYPE}" == "darwin" ]]; then
launchctl unload "${LAUNCHD_CONFIG}"
launchctl load -w "${LAUNCHD_CONFIG}"

echo 'Waiting 10s before checking status'
sleep 10
if launchctl print system/otelcol-sumo | grep "last exit code = 1"; then
echo "Waiting for otelcol to start"
while ! launchctl print system/otelcol-sumo | grep -q "state = running"; do
sleep 0.1
done
OTEL_EXITED_WITH_ERROR=false
echo 'Checking otelcol status'
for i in {1..15}; do
if launchctl print system/otelcol-sumo | grep -q "last exit code = 1"; then
OTEL_EXITED_WITH_ERROR=true
break;
fi
sleep 1
done
if [[ "${OTEL_EXITED_WITH_ERROR}" == "true" ]]; then
echo "Failed to launch otelcol"
tail /var/log/otelcol-sumo/otelcol-sumo.log
exit 1
Expand Down

0 comments on commit 54e233a

Please sign in to comment.