Skip to content

Commit

Permalink
Test redirection of stdout and stderr
Browse files Browse the repository at this point in the history
Change-type: patch
Signed-off-by: Kyle Harding <kyle@balena.io>
  • Loading branch information
klutchell committed Nov 15, 2023
1 parent 4e78146 commit 3c4c916
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/healthcheck.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash

# This script is run as the healthcheck command for the VM image and
# the logs are grepped for the exit status message to determine success/fail.
Expand All @@ -21,8 +21,15 @@ uname -a

df -h

echo "Hello, World!" >/dev/stdout
echo "Hello, World!" >/dev/stderr
ls -al /dev/

echo "Testing stdout" >&1
echo "Testing stderr" >&2
echo "Testing stdout" >/dev/stdout
echo "Testing stderr" >/dev/stderr

echo "Testing stdout" 1> >(tee /tmp/stdout)
echo "Testing stderr" 2> >(tee /tmp/stderr)

if [ -n "${HOSTNAME}" ]; then
test "${HOSTNAME}" = "$(hostname)"
Expand Down

0 comments on commit 3c4c916

Please sign in to comment.