]> gitweb.morketsmerke.org Git - backup.git/commitdiff
Dodanie pliku ftp-motd.
authorxf0r3m <jakubstasinski@protonmail.com>
Sun, 14 Jan 2024 15:44:31 +0000 (16:44 +0100)
committerxf0r3m <jakubstasinski@protonmail.com>
Sun, 14 Jan 2024 15:44:31 +0000 (16:44 +0100)
ftp-motd [new file with mode: 0755]

diff --git a/ftp-motd b/ftp-motd
new file mode 100755 (executable)
index 0000000..89f1f89
--- /dev/null
+++ b/ftp-motd
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# Deps: figlet lolcat
+# Deps GH: https://github.com/xero/figlet-fonts -> /usr/share/figlet-fonts;
+
+echo "ftp" | /usr/bin/figlet -c -f /usr/share/figlet-fonts/3d.flf | lolcat
+echo;
+echo "Today is: $(date)";
+echo;
+echo "System summary: ";
+cpuIdle=$(vmstat | tail -1 | awk '{printf $15}');
+cpuUsage=$((100 - $cpuIdle));
+echo -e "  \tCPU: ${cpuUsage}%";
+echo -e "  \tMEM: $(free -h | sed -n '2p' | awk '{printf $7}' | sed 's/i//') Free";
+echo -e "  \tMount points:\tFree/Total\t(Usage%)";
+mountPointsList="/$ /home$";
+for mountPoint in $mountPointsList; do
+  if $(df -h 2>/dev/null | grep -q "${mountPoint}"); then
+    diskSize=$(df -h 2> /dev/null | grep "${mountPoint}" | awk '{printf $2}');
+    diskFree=$(df -h 2> /dev/null | grep "${mountPoint}" | awk '{printf $4}');
+    diskUsage_perc=$(df -h 2> /dev/null | grep "${mountPoint}" | sed 's/%//' | awk '{printf $5}');
+    echo -e "\t$(echo $mountPoint | sed 's,\$,,'):\t\t${diskFree}/${diskSize}\t(${diskUsage_perc}%)";
+  fi
+done
+echo -e "  \tPROCESSES: $(ps -aux | wc -l | awk '{printf $1}')";
+if $(uptime | grep -q 'day'); then
+  utime=$(uptime | awk '{printf $3" "$4" "$5}' | sed -e 's/\,$//' -e 's,:,h ,');
+  echo -e "\tUPTIME: ${utime}m";
+else
+  utime=$(uptime | awk '{printf $3}' | sed -e 's/,//' -e 's,:,h ,');
+  if $(echo $utime | grep -q "h"); then
+    echo -e "  \tUPTIME: ${utime}m";
+  else
+    echo -e "  \tUPTIME: 0h ${utime}m";
+  fi
+fi
+echo -e " \t$(uptime | grep -o "load.*$" | tr [a-z] [A-Z])";
+echo;
+echo -e "morketsmerke.org @ 2024 https://github.com/xf0r3m/immudex";
+echo;
+echo "====================================================================";