Browse Source

Add tentative whoall parser + hostname file

Alessandro De Gennaro 4 years ago
parent
commit
988533707d
2 changed files with 48 additions and 0 deletions
  1. 31 0
      hostnames
  2. 17 0
      telegrambot_whoallparser.sh

+ 31 - 0
hostnames

@@ -0,0 +1,31 @@
+abe
+actarus
+crash
+duke
+elwood
+gex
+gin
+glados
+jake
+king
+kirk
+lara
+link
+martini
+picard
+pang
+pong
+q
+raziel
+sarek
+snake
+sonic
+spock
+spyro
+tron
+worf
+yoshi
+zombie
+jacobi
+yukawa
+tesla

+ 17 - 0
telegrambot_whoallparser.sh

@@ -0,0 +1,17 @@
+#!/bin/bash
+## Alessandro De Gennaro, 2020-01-16
+## Parse whoall output in machine-readable format for LCM Telegram bot.
+
+NODELIST=$(<hostnames)
+WHOALL_OUTPUT=$(whoall -fn)
+
+for node in $NODELIST
+do
+	WHOALL_NODE_ITERATION=$(echo "$WHOALL_OUTPUT" | grep -w "$node")
+	
+	if [[ $WHOALL_NODE_ITERATION == Empty:* ]]; then
+		echo $node
+	else
+		echo $WHOALL_NODE_ITERATION
+	fi
+done