How to set up/manage services on a computer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
767 B

#!/bin/bash
echo "System:"
echo " Uptime: $(uptime -p | cut -d' ' -f2-) (up since $(uptime -s))"
echo " Memory: $(free -h | grep Mem | perl -pe 's/Mem:\s+([\.\w]+)\s+([\.\w]+)\s+([\.\w]+).*/\1 total, \2 used, \3 free/')"
echo " Swap: $(free -h | grep Swap | perl -pe 's/Swap:\s+([\.\w]+)\s+([\.\w]+)\s+([\.\w]+).*/\1 total, \2 used, \3 free/')"
echo " Load: $(cat /proc/loadavg | cut -d' ' -f1-3 | perl -pe 's/([\.\d]+) ([\.\d]+) ([\.\d]+)/\1 (avg 1 min), \2 (avg 5 min), \3 (avg 15 min)/')"
users=$(w | tail -n +3 | cut -d' ' -f1 | sort | uniq -c | wc -l)
sessions=$(w | tail -n +3 | wc -l)
echo " Logins: $users users with $sessions sessions total"
ip=$(ip -4 addr show wan0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
echo " WAN Addr: $ip"
echo ""