#!/bin/bash #Script to update motd with relevant information. #Define output file motd="/etc/motd" # Collect information # $USER is automatically defined HOSTNAME=`uname -n` KERNEL=`uname -rm` INSTALLED_KERNEL=$(pacman -Qi linux-lts | awk '/Version/ { print $3 }') CPU=`awk -F '[ :][ :]+' '/^model name/ { print $2; exit; }' /proc/cpuinfo` CPU_TEMP=$(($( $motd echo -e " $A. $X $A/#\ $X _ $A _ _ $A/###\ $X __ _ _ __ ___| |__ $A| (_)_ __ _ ___ __ $A/#####\ $X / _' | '__/ __| '_ \ $A| | | '_ \| | | \ \/ / $A/##.-.##\ $X | (_| | | | (__| | | |$A| | | | | | |_| |> < $A/##( )##\ $X \__,_|_| \___|_| |_|$A|_|_|_| |_|\__,_/_/\_\\ $A/#.-- --.#\ $X $A/' '\ $B " >> $motd echo -e "$R===============================================================" >> $motd echo -e " $R KERNEL $W= $KERNEL (installed: $INSTALLED_KERNEL) " >> $motd echo -e " $R CPU $W= $CPU " >> $motd echo -e " $R HOSTNAME $W= $HOSTNAME " >> $motd echo -e " $R SYSTEM $W= $PACMAN packages can be updated " >> $motd echo -e " $R USERS $W= Currently `users | wc -w` users logged on " >> $motd echo -e "$R===============================================================" >> $motd echo -e " $R CPU Usage $W= $LOAD1 1 min $LOAD5 5 min $LOAD15 15 min " >> $motd echo -e " $R CPU Temperature $W= $CPU_TEMP" >> $motd echo -e " $R Memory Used $W= $MEMORY1 / $MEMORY2 " >> $motd echo -e " $R Swap in use $W= `free -m | tail -n 1 | awk '{print $3}'` MB " >> $motd echo -e " $R Processes $W= You are running $PSU of $PSA processes " >> $motd echo -e " $R System Uptime $W= $upDays days $upHours hours $upMins minutes $upSecs seconds " >> $motd echo -e " $R Disk Space Used (md0) $W= $DISC " >> $motd echo -e "$R===============================================================" >> $motd echo -en "$W" >> $motd zpool list >> $motd echo -e "$R===============================================================" >> $motd script -c "systemctl --failed" /dev/null | grep -E '●| UNIT' >> $motd echo -e "$X" >> $motd