This repository has been archived on 2024-03-13. You can view files and clone it, but cannot push or open issues or pull requests.
LinuxUpskillChallenge/wait_ready.sh

24 lines
431 B
Bash
Executable File

#!/bin/bash
if [ -z ""]
then
LABEL="UpskillChallengeNode"
fi
NODESTATE="indeterminate"
while [ "$NODESTATE" != "running" ]
do
OLDSTATE=$NODESTATE
NODESTATE=$(linode-cli linodes list --format 'status' --label "$LABEL" --text | tail -n 1)
if [ "$NODESTATE" = "status" ]
then
echo "No node detected."
exit 1
fi
if [ "$NODESTATE" != "$OLDSTATE" ]
then
echo "$(date '+%F %T'): $NODESTATE"
fi
done