Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MOTD-Plus

License: GPL v3 Shell Platform

A self-contained, colorful Message of the Day for Raspberry Pi OS and Debian servers.

MOTD-Plus replaces the plain login banner with a boxed, at-a-glance system dashboard: uptime, load, memory and swap, CPU temperature, disk usage, OS and kernel info, pending updates, and your own access/security notices. It is a self-contained Bash script with no dependencies beyond the standard Linux userland, and it renders in the dynamic MOTD shown on every SSH or console login.

╔═══════════════════════════════════════════════════════════════════╗
║ WELCOME TO RPI-NODE1 SERVER                                       ║
╠═══════════════════════════════════════════════════════════════════╣
║ -- SYSTEM STATUS ------------------------------------------------ ║
║ DATE      : 07/12/2026 11:52:05 AM CEST                           ║
║ UPTIME    : 7 day(s) 2 hour(s) 1 minute(s) 20 second(s)           ║
║ LOAD AVG  : 1m: 14.5%, 5m: 19.2%, 15m: 22.2% (across 4 core(s))   ║
║ CPU TEMP  : 54.3°C                                                ║
║ MEMORY    : [▪▪▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫]  12% (0.9G / 7.9G)             ║
║ SWAP      : [▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫]   0% (0.0G / 0.5G)             ║
╠═══════════════════════════════════════════════════════════════════╣
║ -- SYSTEM INFO -------------------------------------------------- ║
║ OS        : Debian GNU/Linux 12 (bookworm)                        ║
║ KERNEL    : 6.12.93+rpt-rpi-2712                                  ║
║ UPDATES   : 20 package(s) can be updated                          ║
╠═══════════════════════════════════════════════════════════════════╣
║ -- DISK USAGE --------------------------------------------------- ║
║ DISK /              : [▪▪▪▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫]  15% (7.8G /  58.0G) ║
║ DISK /nvme          : [▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫]   1% (0.0G / 457.4G) ║
║ DISK /boot/firmware : [▪▪▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫▫]  12% (0.1G /   0.5G) ║
╠═══════════════════════════════════════════════════════════════════╣
║ -- NOTICE ------------------------------------------------------- ║
║ ACCESS    : Authorized access only. All activity is monitored.    ║
║ SECURITY  : Maintain operational integrity and accountability.    ║
╚═══════════════════════════════════════════════════════════════════╝

(Colors are shown in the real terminal; disk/memory bars turn green → yellow → red as usage crosses the 70% and 85% thresholds.)

Features

  • Boxed dashboard — A single auto-sized Unicode box, grouped into System Status, System Info, Disk Usage, and Notice sections. The box width adapts to the longest line, and padding stays correct even with embedded ANSI color codes.
  • Live system status — Local date/time, uptime, and load averages (1/5/15 minute) shown as a percentage of total CPU capacity.
  • Memory and swap — Usage bars with used/total in GiB. Swap is shown only when swap is actually configured.
  • CPU temperature — Uses vcgencmd on Raspberry Pi hardware, falling back to /sys/class/thermal on other boards. Omitted entirely if no sensor is available.
  • Disk usage — One aligned bar per device-backed filesystem, with used/total sizes.
  • Color thresholds — Load, memory, swap, disk, and temperature are colored green (≤70), yellow (≤85), and red (>85) so problems stand out.
  • Pending updates — Reports the number of available package updates from a small cache file (see How the update count works).
  • Custom notices — Two configurable lines for access and security messaging.
  • No extra dependencies — Pure Bash plus coreutils (date, df, nproc, uname) and awk. Nothing to install, nothing to compile.

Prerequisites

MOTD-Plus is pure Bash and reads system state straight from /proc, /sys, and /etc/os-release, so it relies only on tools that ship with the base system — on a stock Raspberry Pi OS or Debian install there is normally nothing to install. It needs:

  • Raspberry Pi OS or Debian 12 (Bookworm) or later — this is the tested baseline; older releases may work but are unsupported.
  • Bash 4+ — uses ${var^^} and other modern parameter expansions (Bookworm and later ship Bash 5).
  • coreutilsdate, df, nproc, uname, install.
  • An awk (mawk is the Debian default; gawk also works).
  • libpam-modules — provides the dynamic-MOTD mechanism (pam_motd); installed by default.
  • Optional: vcgencmd (libraspberrypi-bin, pre-installed on Raspberry Pi OS) for CPU temperature. On other boards the script falls back to /sys/class/thermal, and if neither is available the CPU temperature line is simply omitted.

All of these are part of a default Raspberry Pi OS or Debian installation. On an unusually minimal image you can make sure they are present with:

sudo apt update
sudo apt install --no-install-recommends bash coreutils mawk libpam-modules

Installing the script and the update helper requires root (they live in /etc/update-motd.d/ and /etc/cron.hourly/). The commands below use sudo, which is preinstalled on Raspberry Pi OS. A minimal Debian install ships without sudo — there, run the same commands as the root user (drop the sudo prefix, after su -).

To fetch the repository with the Quick install you also need git:

sudo apt install git

git is only for cloning — if you'd rather not install it, download the source archive from GitHub and use the Manual install instead.

Note: MOTD-Plus intentionally does not depend on lsb-release (it reads /etc/os-release directly) or on procps/the hostname package, so it works on minimal images without pulling in extra packages.

How the MOTD is displayed

Both Raspberry Pi OS and Debian build the login banner through pam_motd, which runs every executable script in /etc/update-motd.d/ at login and caches the result in /run/motd.dynamic. Installing MOTD-Plus is therefore just a matter of dropping the script into that directory and making it executable — no service, no daemon.

Repository layout

The repo mirrors the target filesystem, so you can see exactly where each file installs:

motd-plus/
├── install.sh                       # installer (copies the etc/ tree into place)
├── etc/
│   ├── update-motd.d/
│   │   └── 50-motd-plus             → /etc/update-motd.d/50-motd-plus  (the MOTD renderer)
│   └── cron.hourly/
│       └── check-updates            → /etc/cron.hourly/check-updates  (update-count refresh)
├── README.md · CHANGELOG.md · LICENSE.md

Installation

The steps below are identical on Raspberry Pi OS and Debian.

Quick install

git clone https://github.com/nandortoth/motd-plus.git
cd motd-plus

# Install both files and populate the update count
sudo ./install.sh

# Or also disable the stock banners so MOTD-Plus is the only one shown
sudo ./install.sh --quiet-defaults

install.sh copies etc/update-motd.d/50-motd-plus and etc/cron.hourly/check-updates into /etc, then runs the update-count helper once. With --quiet-defaults it also disables the other update-motd.d fragments and blanks /etc/motd. Run ./install.sh --help for details.

Manual install

If you'd rather not use the installer:

# 1. The MOTD renderer (the 50- prefix controls run order; lower = earlier)
sudo install -D -m 0755 etc/update-motd.d/50-motd-plus /etc/update-motd.d/50-motd-plus

# 2. The hourly update-count helper (cron.hourly files must have NO extension)
sudo install -D -m 0755 etc/cron.hourly/check-updates /etc/cron.hourly/check-updates
sudo /etc/cron.hourly/check-updates   # populate the count immediately

# 3. (Optional) quiet the stock banners so only MOTD-Plus shows
sudo chmod -x /etc/update-motd.d/* 2>/dev/null
sudo chmod +x /etc/update-motd.d/50-motd-plus
sudo truncate -s 0 /etc/motd 2>/dev/null || true

On Raspberry Pi OS the "last login" line comes from pam_lastlog, and the default help text and uname line come from the stock 10-help-text / 10-uname fragments — the chmod -x above disables the latter two.

Test it

# Render exactly what a login will show
sudo run-parts /etc/update-motd.d/

# Or run the renderer directly
sudo /etc/update-motd.d/50-motd-plus

Then open a fresh SSH session to confirm the banner appears on login.

How the update count works

The UPDATES line reads a plain integer from /var/cache/motd-updates.count. This is deliberately decoupled from the MOTD so that login stays instant — the banner never runs apt itself. etc/cron.hourly/check-updates refreshes that count once an hour:

apt update -qq
UPDATES_AVAILABLE=$(apt list --upgradable 2>/dev/null | grep -vc "Listing...")
echo "$UPDATES_AVAILABLE" > /var/cache/motd-updates.count

Until the file exists, the MOTD shows Update info not available — which is expected on a fresh install.

Updating MOTD-Plus

MOTD-Plus is just two scripts, so updating is a pull-and-reinstall:

cd motd-plus
git pull
sudo ./install.sh

Re-running install.sh overwrites the installed copies with the new versions (it uses install -D, so it replaces in place) and refreshes the update count. Pass --quiet-defaults again if you rely on it — the flag isn't remembered between runs. To update a manually installed copy, re-run the two install -D commands from Manual install.

If you customized ACCESS_MSG, SECURITY_MSG, or the color thresholds, make those edits in your local repo copy of etc/update-motd.d/50-motd-plus and commit or git stash them before git pull — otherwise the reinstall (or a merge conflict) will overwrite them. Editing the installed /etc/update-motd.d/50-motd-plus directly is not preserved across a reinstall.

Configuration

The script is short and readable; the two most common tweaks are near the top of etc/update-motd.d/50-motd-plus:

  • Notice lines — Edit ACCESS_MSG and SECURITY_MSG.
  • Color thresholds — Adjust the 70 / 85 boundaries in the colorize() function.
  • Bar length — Change length=20 in usage_bar().

After editing, reinstall by re-running sudo ./install.sh (or the manual install command above).

Uninstall

sudo rm -f /etc/update-motd.d/50-motd-plus
sudo rm -f /etc/cron.hourly/check-updates
sudo rm -f /var/cache/motd-updates.count
# Optionally re-enable any default fragments you disabled with --quiet-defaults.

License

MOTD-Plus is free software, released under the GNU General Public License v3.0 or later.

Contact

About

A self-contained, colorful Message of the Day for Raspberry Pi OS and Debian servers.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages