For those of us who manage multiple servers in multiple locations it can be beneficial to have a quick “system briefing” provided when we login to a Linux server via SSH. The Linux Message of the Day (MOTD) can be used for this.
I’ve created a simple script which will provide basic system information including the servers name, public IP, OS version, load averages, uptime etc.
To install the script:
1. Create a new text file named systemstats.sh:
# nano -w /usr/local/bin/systemstats.sh
2. Paste the following into the text file:
#!/bin/bash
#
# Server Status Script
# Version 0.1.3 m
# Updated: July 26th 2011 m
CPUTIME=$(ps -eo pcpu | awk ‘NR>1’ | awk ‘{tot=tot+$1} END {print tot}’)
CPUCORES=$(cat /proc/cpuinfo | grep -c processor)
UP=$(echo `uptime` | awk ‘{ print $3 ” ” $4 }’)
echo ”
System Status Continue reading “Create a Linux Server Status MOTD”