Skip to content

Instantly share code, notes, and snippets.

@manugupt1
Created September 11, 2022 04:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manugupt1/19db623c5cb3cc11a2cb58f23a176ba5 to your computer and use it in GitHub Desktop.
Save manugupt1/19db623c5cb3cc11a2cb58f23a176ba5 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -x
set -euo pipefail
exec 5<> $PWD/CONTAINER_WAIT
exec 3<> $PWD/CONTAINER_STDOUT
exec 4<> $PWD/CONTAINER_STDERR
truncate -s 0 /tmp/logger
truncate -s 0 /tmp/stdout
echo $PWD >> /tmp/logger
ls $PWD >> /tmp/logger
sleep 2
exec 5>&-
rm $PWD/CONTAINER_WAIT
for i in {1..5}
do
read -u 3 stdout
cat $stdout>>/tmp/stdout
# echo ${LINE} >>/tmp/stderr
sleep 1
done
exec 3>&-
exec 4>&-
rm $PWD/CONTAINER_STDERR
rm $PWD/CONTAINER_STDOUT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment