added listing of subhosts
authorRalph Ronnquist <ralph.ronnquist@gmail.com>
Fri, 25 Mar 2022 09:57:49 +0000 (20:57 +1100)
committerRalph Ronnquist <ralph.ronnquist@gmail.com>
Fri, 25 Mar 2022 09:57:49 +0000 (20:57 +1100)
functions
overlay-go

index feb500e4839a8fa8990450d7cd836b4d28e9379e..968c99db93603adddc6135312d61652dc187eea0 100644 (file)
--- a/functions
+++ b/functions
@@ -122,3 +122,11 @@ is_live() {
     [ -z "$USPID" ] && return 1
     echo $USPID $(pgrep -f ".reaper $NAME")
 }
+
+list_running() {
+    for C in $(pgrep -a overlay-boot | awk '{print $4}') ; do
+       eval NAME="$(sed "/^NAME=.*/{s|^NAME=||;b};d" $C)"
+       [ -z "$NAME" ] && NAME=$(basename $C .conf)
+       echo $NAME
+    done
+}
index d22ef35a0310718ca2ad11889b7b781c66d40acd..b055d9840394cd897ee37c5b0931622815501152 100755 (executable)
@@ -5,6 +5,11 @@
 
 NAME="$1"
 
+if [ -z "$NAME" ] ; then
+    echo "Select subhost: $(list_running)"
+    exit 0
+fi
+
 read USPID RSPID <<EOF
 $(is_live $NAME)
 EOF