Page 1 of 1

Simple MOTD for Debian Desktop

Posted: 2021-05-01 00:24
by craigevil
Ubuntu-like "message of the day" screen for Debian desktop terminals, without the requirement of PAM

https://github.com/angela-d/simple-motd ... an-desktop

It needs figlet and lolcat. YES I know it hasn't been updated since 2019. But it really doesn't do much. Plus the script that actually runs is pretty easy to see what it does.

Although I do not think the Swap part is correct. Just not sure what to change it to.

I had to edit the config, then copy it to /usr/bin

Here is what it looks like on my system: https://imgur.com/TMEX3Dx

Code: Select all


#!/bin/sh



#BANNER=Debian Sid



[ -r /etc/lsb-release ] && . /etc/lsb-release



if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ];

then

  # Fall back to using the very slow lsb_release utility

  DISTRIB_DESCRIPTION=$(lsb_release -s -d)

fi



figlet Debian Sid -c | lolcat -f

printf "\n"



printf "\t%s \t\tKernel: %s\n" "$DISTRIB_DESCRIPTION" "$(uname -r)"

printf "\n"



date=$(date)

load=$(cat /proc/loadavg | awk '{print $1}')

root_usage=$(df -h / | awk '/\// {print $(NF-1)}')

memory_usage=$(free -t -g | grep Total | awk '{print $3;}')

total_memory=$(free -t -g | grep "Mem" | awk '{print $2" GB";}')

swap_usage=$(free -m | awk '/Swap/ { printf("%3.1f%%", "exit !$2;$3/$2*100") }')

time=$(uptime | grep -ohe 'up .*' | sed 's/,/\ hours/g' | awk '{ printf $2" "$3 }')

processes=$(ps aux | wc -l)



printf "\t\tAs of: %s\n\n" "$date"

printf "\tSystem load:\t%s\t\tProcesses:\t%s\n" "$load" "$processes"

printf "\tMemory usage:\t%s/%s\t\tUptime:\t\t%s\n" "$memory_usage" "$total_memory" "$time"

printf "\tDisk usage:\t%s\t\tSwap:\t\t%s\n\n" "$root_usage" "$swap_usage"