Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Simple MOTD for Debian Desktop

Here you can discuss every aspect of Debian. Note: not for support requests!
Post Reply
Message
Author
User avatar
craigevil
Posts: 5391
Joined: 2006-09-17 03:17
Location: heaven
Has thanked: 28 times
Been thanked: 39 times

Simple MOTD for Debian Desktop

#1 Post 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"
Raspberry PI 400 Distro: Raspberry Pi OS Base: Debian Sid Kernel: 5.15.69-v8+ aarch64 DE: MATE Ram 4GB
Debian - "If you can't apt install something, it isn't useful or doesn't exist"
My Giant Sources.list

Post Reply