Hey everyone - Hope this is the right place for this discussion....
I was bored the other day and thought I need to better MOTD instead of the plain old: Have some fun..... (openSuSe standard)
So I came up with the thought of having a MOTD that tells me stuff I wanted to see so I created the below script.
Do you guys have a cool / changing MOTD or something similar?
--cAm
Code:
#!/bin/bash
# Created by cAm34
# Save as /etc/cron.hourly/motd.sh or where ever you feel suitable
main() {
echo
echo -e '\E[0;31m'"\033[1mLatest Logins: \033[0m"
last | head -n 3
echo
echo -e '\E[0;31m'"\033[1mLatest SSH Failures: Total Count:\033[0m $(grep sshd /var/log/messages| awk '/failure/' | wc -l)"
grep sshd /var/log/messages| awk '/failure/ {print $1,$3,$9,$10,$11,$12,$13}' /var/log/messages | tail -n 3
echo
echo -e '\E[0;31m'"\033[1mLatest 5 /var/log/messages entries: \033[0m"
tail -n 5 /var/log/messages
echo
echo -e '\E[0;31m'"\033[1mLatest Hardware Errors: \033[0m"
dmesg | grep -i error | tail -n 3
echo
echo -e '\E[0;31m'"\033[1mLatest DMESG Messages: \033[0m"
dmesg | tail -n 3
echo -e
echo -ne '\E[0;31m'"\033[1mUptime: \033[0m $(uptime | cut -d " " -f 5-18)"
echo
echo
echo -e '\E[0;34m'"\033[1m Welcome to $(hostname) - The above info is generated every hour\033[0m"
echo -e '\E[0;34m'"\033[1m Have a fun stay and play nice...\033[0m"
echo
}
main > /etc/motd