2023-09-01 15:42:19 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Update dynamic MOTD file
|
|
|
|
# {{ ansible_managed }}
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
|
|
|
|
TMPFILE=$(mktemp)
|
|
|
|
TGTFILE=/run/pvc-motd.dynamic
|
2023-09-01 15:42:20 -04:00
|
|
|
DEBVER="$( grep 'PRETTY_NAME=' /etc/os-release | awk -F'"' '{ print $2 }' )"
|
2023-09-01 15:42:19 -04:00
|
|
|
|
|
|
|
echo >> $TMPFILE
|
2023-09-01 15:42:20 -04:00
|
|
|
echo "\033[01;34mParallel Virtual Cluster \033[01;36m(${DEBVER})\033[0m" >> $TMPFILE
|
2023-09-01 15:42:19 -04:00
|
|
|
echo -n "> \033[01;32m$(hostname)\033[0m" >> $TMPFILE
|
|
|
|
if test -f /etc/hostdesc; then
|
|
|
|
echo " - $( cat /etc/hostdesc )" >> $TMPFILE
|
|
|
|
else
|
|
|
|
echo >> $TMPFILE
|
|
|
|
fi
|
|
|
|
# Get machine information
|
2023-09-01 15:42:27 -04:00
|
|
|
MANUFACTURER="$( /usr/sbin/dmidecode | grep -A1 'Chassis Information' | tail -1 | awk -F':' '{print $2}' | tr -s ' ' )"
|
|
|
|
if [[ -z ${MANUFACTURER} ]]; then
|
|
|
|
MANUFACTURER='Unknown'
|
|
|
|
fi
|
|
|
|
echo "> \033[1;37mPVC node\033[0m on \033[1;31m${MANUFACTURER}\033[0m hardware" >> $TMPFILE
|
2023-09-01 15:42:19 -04:00
|
|
|
echo "> $(/bin/uname -srvmo)" >> $TMPFILE
|
|
|
|
|
|
|
|
mv $TMPFILE $TGTFILE || rm $TMPFILE
|