This repository has been archived on 2024-03-13. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
LinuxUpskillChallenge/wait_ready.sh

23 lines
431 B
Bash
Raw Permalink Normal View History

#!/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