From 7bfa18ff7a56b3a843395b8971c5911542878d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Krup=C4=8D=C3=ADk?= <lukas.krupcik@vsb.cz> Date: Mon, 3 Oct 2016 13:45:20 +0200 Subject: [PATCH] test md tabulky --- .../shell-and-data-access.md | 4 +- motd.sh | 53 +++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 motd.sh diff --git a/docs.it4i/anselm-cluster-documentation/accessing-the-cluster/shell-and-data-access.md b/docs.it4i/anselm-cluster-documentation/accessing-the-cluster/shell-and-data-access.md index 22755905a..a5cc8435f 100644 --- a/docs.it4i/anselm-cluster-documentation/accessing-the-cluster/shell-and-data-access.md +++ b/docs.it4i/anselm-cluster-documentation/accessing-the-cluster/shell-and-data-access.md @@ -5,8 +5,8 @@ Interactive Login ----------------- The Anselm cluster is accessed by SSH protocol via login nodes login1 and login2 at address anselm.it4i.cz. The login nodes may be addressed specifically, by prepending the login node name to the address. -|Login address|Port|Protocol|Login node| -|---|---| + + |anselm.it4i.cz|22|ssh|round-robin DNS record for login1 and login2| |login1.anselm.it4i.cz|22|ssh|login1| |login2.anselm.it4i.cz|22|ssh|login2| diff --git a/motd.sh b/motd.sh new file mode 100644 index 000000000..accbb62e6 --- /dev/null +++ b/motd.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +### MOTD and Downtime history +# autor: kru0052 +# 2016 IT4Innovations +### + +printf "update" +wget -q http://www.it4i.cz/support/?lang=en +printf " ... OK\n" + +i="index.html?lang=en" + +HEAD=$(grep -n -m1 'class="matrix light-grey' "$i" |cut -f1 -d: | tr --delete '\n') +END=$(grep -n -m1 '<h3>Other</h3>' "$i" |cut -f1 -d: | tr --delete '\n') +LAST=$(wc -l "$i" | cut -f1 -d' ') +DOWN=$((LAST-END+2)) + +sed '1,'"$((HEAD-1))"'d' "$i" | sed -n -e :a -e '1,'"$DOWN"'!{P;N;D;};N;ba' | sed '/<div/d' > "TMP.html" +rm "$i" + +title="Message of the day" +head=$(cat TMP.html | grep "rss-item-title" | cut -d ">" -f 2 | cut -d "<" -f 1) +date=$(cat TMP.html | grep "<i>" | cut -d ">" -f 2 | cut -d "<" -f 1 | cut -d " " -f 1) +info=$(cat TMP.html | grep "<p>" | cut -d ">" -f 2 | cut -d "<" -f 1) +rm TMP.html + +echo "" +echo "$title" +echo "$date - $head" +echo "$info" +echo "" + +# poovolene stavy - Salomon Maintenance, Anselm Maintenance, Back in Production, Infrastructure Maintenance, PBS Maintenance, SCRATCH Maintenance, HOME Maintenance, Salomon and Anselm Maintenance +if [ "$head" = "Salomon Maintenance" ] || [ "$head" = "Anselm Maintenance" ] || [ "$head" = "Back in Production" ] || [ "$head" = "Infrastructure Maintenance" ] || [ "$head" = "PBS Maintenance" ] || [ "$head" = "SCRATCH Maintenance" ] || [ "$head" = "HOME Maintenance" ] || [ "$head" = "Salomon and Anselm Maintenance" ]; then + dateDown=$(cat downtimes_history.md | sed -n '/---/{n;p;}' | cut -d "|" -f 2 | cut -d " " -f 1) + headDown=$(cat downtimes_history.md | sed -n '/---/{n;p;}' | cut -d "|" -f 3 | cut -d "*" -f 3) + + if [ "$date" = "$dateDown" ] && [ "$head" = "$headDown" ]; then + echo "Everything up-to-date..." + else + echo "Updating Downtime History..." + test=" |$date|**$head** $info|" + sed '/---/a '"$test"'' downtimes_history.md > TMP.md + cat TMP.md > downtimes_history.md + rm TMP.md + fi + #echo "### $title" > MOTD.md + #echo "**$head**" >> MOTD.md + #echo "$date - $info" >> MOTD.md +else + echo "Downtime History not updated..." +fi -- GitLab