Last active
October 21, 2023 18:36
[landscape-sysinfo alternative ], more cross-linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Simple motd script for any systemd Linux (tested on Debian) | |
# Inspiration: https://superuser.com/questions/919962/landscape-sysinfo-for-centos | |
# Inspiration 2: https://github.com/thusoy/headsup/blob/master/headsup.py | |
os-name=$() | |
os-kernel=$() | |
date-today=$() | |
system-load=$() | |
processes=$(cat /proc/loadavg | cut -d"/" -f2| cut -d" " -f1) | |
logged-users=$() | |
fs-usage=$() | |
memory-usage=$() | |
swap-usage=$() | |
main-interface-ip=$() | |
update-total-packages=$() | |
update-security-packages=$() | |
lastlogin=$() | |
lastb=$() | |
uptime=$(uptime | cut -d" " -f 4-7 | cut -d"," -f1-2) | |
echo -e "Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-106-generic x86_64)" | |
echo | |
echo -e " System information as of Thu Feb 1 23:51:28 ART 2018" | |
echo | |
echo -e " System load: 0.0 Processes: 91" | |
echo -e " Usage of /: 69.7% of 15.62GB Users logged in: 0" | |
echo -e " Memory usage: 15% IP address for eth0: 1.1.1.1" | |
echo -e " Swap usage: 0%" | |
echo | |
# echo -e " Graph this data and manage this system at:" | |
# echo -e " https://landscape.canonical.com/" | |
echo | |
echo -e "81 packages can be updated." | |
echo -e "69 updates are security updates." | |
echo | |
echo -e "New release '16.04.3 LTS' available." | |
echo -e "Run 'do-release-upgrade' to upgrade to it." | |
echo | |
echo -e "Last login: Thu Feb 1 12:45:42 2018 from 108.8.219.35" | |
exit 0 | |
# created by Vitalijus Ryzakovas | |
b=`tput bold` | |
n=`tput sgr0` | |
echo "Checking for system updates:" | |
while ps aux | grep -e [y]um > /dev/null; do echo -n .;sleep 1; done & | |
up=`yum -e0 -d0 check-update | awk '{print $1}'` | |
reset | |
echo -e "${b}Hostname:${n} `hostname` \t\t IP address: `/sbin/ifconfig venet0:0 | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}'`" | |
echo -e "${b}CPU load:${n} `cat /proc/loadavg | cut -d" " -f1-3`" | |
echo -e "${b}Uptime:${n} `uptime | cut -d" " -f 4-7 | cut -d"," -f1-2`" | |
echo -e "Free memorry: `cat /proc/meminfo | grep MemFree | awk {'print int($2/1000)'}` MB \t\t Total memory: `cat /proc/meminfo | grep MemTotal | awk {'print int($2/1000)'}` MB" | |
echo -e "${b}Available updates:${n} `if [[ ! -n "${up}" ]]; then echo "system up-to-date"; else echo $up; fi`\n" | |
echo -e "Mail quere length: `exim -bpc`" | |
echo -e "Proccess number: `cat /proc/loadavg | cut -d"/" -f2| cut -d" " -f1`\n" | |
echo -e "${b}Active sessions:${n} `w | tail -n +2`" | |
# Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-106-generic x86_64) | |
# | |
# * Documentation: https://help.ubuntu.com/ | |
# | |
# System information as of Thu Feb 1 23:51:28 ART 2018 | |
# | |
# System load: 0.0 Processes: 91 | |
# Usage of /: 69.7% of 15.62GB Users logged in: 0 | |
# Memory usage: 15% IP address for eth0: | |
# Swap usage: 0% | |
# | |
# Graph this data and manage this system at: | |
# https://landscape.canonical.com/ | |
# | |
# 81 packages can be updated. | |
# 69 updates are security updates. | |
# | |
# New release '16.04.3 LTS' available. | |
# Run 'do-release-upgrade' to upgrade to it. | |
# | |
# Last login: Thu Feb 1 12:45:42 2018 from 108.8.219.35 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment