i have a docker-compose.yml file and when i run it ,it run a sh script. In sh script i have $SECONDS to count the seconds upto 120 seconds.It works as expected when I run it from command line. I was trying to achieve the same effect using docker container.
echo "right before second"
echo $SECONDS
echo "right after second"
interval=10
##((end_time = ${SECONDS} + 120))
while ((${SECONDS} < 120)); do
SuccessMessage=$(grep "successful" $LOG_FILE | wc -l)
# cmd=$?
if [ $SuccessMessage -gt 0 ]; then
echo "Successful"
exit 0
fi
echo "Waiting..."
sleep ${interval}
done
echo " Failed to Start"
exit 1
when i run it in docker it's not printing echo message , its giving me this.
mui-MetaLibrary-1 | right before second
mui-MetaLibrary-1 |
mui-MetaLibrary-1 | right after second
mui-MetaLibrary-1 | /opt/app/zuulStartContainer.sh: line 26: can't open 120: no such file
nothing is printing in $SECONDS . can someone tell how can i print SECONDS while running in docker