Last active
January 21, 2024 21:43
-
-
Save tuklusan/30abb07ba20e81a28ffc753f69e5503b to your computer and use it in GitHub Desktop.
hecnet-nodes-for-pydecnet.sh: Grabs HECnet node database and converts to format expected by Paul Koning's DECnet/Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# -- | |
# hecnet-nodes-for-pydecnet.sh | |
# grabs HECnet node list from MIM and produces node names configuration | |
# file for DECnet/Python | |
# | |
# Author: Supratim Sanyal <supratim at riseup dot net> | |
# -- | |
OUTFILE="nodenames.conf" | |
TMPFILE="/tmp/mimnodeslist.txt" | |
###if ! wget -O ${TMPFILE} http://mim.update.uu.se/hecnod; then | |
if ! wget -O ${TMPFILE} http://mim.stupi.net/hecnod; then | |
echo "$0: error - wget failed" | |
exit 1 | |
fi | |
echo "# HECnet Node List: `date` generated on `hostname`" > ${OUTFILE} | |
echo "node 1.13 MIM" >> ${OUTFILE} | |
FOO=`cat ${TMPFILE} | dos2unix | egrep "^[0-9]" | cut -f 1-2 -d " " | sed -re 's/^/node /' | sed -re 's/[(]/ /' | sed -re 's/[)]//'` | |
echo "${FOO}" | while read -r LINE ; do | |
if [[ ${LINE} == "node "[0-9]*" "* ]]; then | |
echo "${LINE}" >> ${OUTFILE} | |
else | |
echo "SKIPPED ${LINE}" | |
fi | |
done | |
echo "$0: Written ${OUTFILE}" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment