2021-02-11 05:06:24 +01:00
|
|
|
#!/run/current-system/sw/bin/bash
|
|
|
|
# Kernel information
|
|
|
|
LINUX=$(uname -rs | cut -d " " -f2)
|
|
|
|
|
|
|
|
# System uptime
|
|
|
|
uptime=$(cut -f1 -d. </proc/uptime)
|
|
|
|
upDays=$((uptime / 60 / 60 / 24))
|
|
|
|
upHours=$((uptime / 60 / 60 % 24))
|
|
|
|
upMins=$((uptime / 60 % 60))
|
|
|
|
upSecs=$((uptime % 60))
|
|
|
|
|
|
|
|
# System load
|
|
|
|
MEMORY=$(free -m | awk 'NR==2{printf "%s/%sMB (%.2f%%)\n", $3,$2,$3*100/$2 }')
|
|
|
|
CPU_LOAD=$(uptime | cut -d: -f5)
|
|
|
|
|
|
|
|
echo "============================================================
|
|
|
|
- Kernel..............: $LINUX
|
|
|
|
- System load.........:$CPU_LOAD
|
|
|
|
- Memory used.........: $MEMORY
|
|
|
|
- System uptime.......: $upDays days $upHours hours $upMins minutes $upSecs seconds
|
|
|
|
============================================================"
|
|
|
|
services=(
|
|
|
|
"syncthing.service"
|
|
|
|
"radicale.service"
|
|
|
|
"miniflux.service"
|
|
|
|
"phpfpm-wallabag.service"
|
|
|
|
"gitea.service"
|
|
|
|
"matrix-synapse.service"
|
2022-01-13 21:15:22 +01:00
|
|
|
"mautrix-telegram.service"
|
2021-02-11 05:06:24 +01:00
|
|
|
"nginx.service"
|
2021-02-21 18:11:35 +01:00
|
|
|
"dnsmasq.service"
|
2022-05-02 16:19:08 +02:00
|
|
|
"docker-openbooks.service"
|
2021-02-11 05:06:24 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
for var in "${services[@]}"; do
|
|
|
|
if [[ -z $var ]]; then
|
|
|
|
printf "\n"
|
|
|
|
else
|
|
|
|
if systemctl -q is-active "${var}"; then
|
|
|
|
printf "%-40s [\e[32mOK\e[39m]\n" "$var"
|
|
|
|
else
|
|
|
|
printf "%-40s [\e[31mFAIL\e[39m]\n" "$var"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "============================================================"
|