diff options
-rwxr-xr-x | builder.sh | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -61,6 +61,15 @@ function world_exists() { return $? } +function world_list() { + for WORLD in $WORLDS/*/; do + WORLD=$(basename $WORLD) + [ -e "$WORLDS/$WORLD.lock" ] && source "$WORLDS/$WORLD.lock" + [ -z "$ASSIGNED_TO" ] || WORLD="$WORLD (-> $ASSIGNED_TO)" + echo $WORLD + done +} + # 1: world 2: instance function world_assign() { local WORLD="$1" @@ -107,6 +116,29 @@ function instance() { exit $? } +function instance_list() { + for INSTANCE in $INSTANCES/*/; do + INSTANCE="$(basename "$INSTANCE")" + instance_status "$INSTANCE" > /dev/null 2>&1 && INSTANCE+=" (RUNNING)" + echo "$INSTANCE" + done + return 0 +} + +function instance_status() { + instance_exists "$1" || fail "instance $1 not found." + + local PWD="$(pwd)" + + cd "$INSTANCES/$1" + + $RUNNER status + local RET=$? + + cd "$PWD" + return $RET +} + function instance_exists() { [ -d "$INSTANCES/$1" ] return $? |