update mymotd

This commit is contained in:
Ruben Blanco 2023-10-30 16:49:30 +01:00
parent 9668934c95
commit 5c34f9075c
1 changed files with 17 additions and 7 deletions

View File

@ -1,5 +1,6 @@
#!/bin/bash
GREEN="\033[0;32m"
WHITE="\033[0;37m"
RED='\033[0;31m'
RESET="\033[0m"
LAST_LOGIN_USER=$(lastlog | tail -n 1 | awk '{print $1}')
@ -8,15 +9,24 @@ LAST_LOGIN_IP_FROM_USER=$(lastlog | tail -n 1 | awk '{print $3}')
UPTIME_SYSTEM=$(uptime -p | tr -d ',')
NUMBER_USERS_CONNECTED=$(uptime | awk '{print $6}' | tr -d ",")
LIST_USERS_CONNECTED=$(w | tail -n +2)
KERNEL=$(uname -r)
PACKAGES=$(dpkg -l | tail -n +6 | wc -l)
SHELL=$(dpkg -l | grep bash | head -n 1 | awk '{ print $2 }')
BASH_VERSION_NUMBER=$(echo $BASH_VERSION | cut -c -6)
source /etc/os-release
echo -e "****************************************************************************"
echo -e "${GREEN} _${RESET}"
echo -e "${GREEN} | |${RESET}"
echo -e "${GREEN} _ _ ____ ____ _ | |____ ____| |_ _ _ ____ ____${RESET}"
echo -e "${GREEN}| | | / _ )/ ___) || | _ \ / _ | _) | | |/ ___) _ |${RESET}"
echo -e "${GREEN} \ V ( (/ /| | ( (_| | | | ( ( | | |_| |_| | | ( ( | |${RESET}"
echo -e "${GREEN} \_/ \____)_| \____|_| |_|\_||_|\___)____|_| \_||_|${RESET}"
echo -e "${WHITE} _${RESET}"
echo -e "${WHITE} | |${RESET}${GREEN} _${RESET}"
echo -e "${WHITE} _ _ ____ ____ _ | |${RESET}${GREEN} ____ ____| |_ _ _ ____ ____${RESET}"
echo -e "${WHITE}| | | / _ )/ ___) || |${RESET}${GREEN}| _ \ / _ | _) | | |/ ___) _ |${RESET}"
echo -e "${WHITE} \ V ( (/ /| | ( (_| |${RESET}${GREEN}| | | ( ( | | |_| |_| | | ( ( | |${RESET}"
echo -e "${WHITE} \_/ \____)_| \____|${RESET}${GREEN}|_| |_|\_||_|\___)____|_| \_||_|${RESET}"
echo -e ""
echo -e "${RED}Host:${RESET}\n$HOSTNAME"
echo -e "${RED}Host:${RESET} $HOSTNAME"
echo -e "${RED}OS:${RESET} $PRETTY_NAME"
echo -e "${RED}Kernel:${RESET} $KERNEL"
echo -e "${RED}Packages:${RESET} $PACKAGES"
echo -e "${RED}Shell:${RESET} $SHELL $BASH_VERSION_NUMBER"
echo -e "${RED}Last Login:${RESET}\nUser -> $LAST_LOGIN_USER\nTime -> $LAST_LOGIN_TIME_HOUR\nIP -> $LAST_LOGIN_IP_FROM_USER"
echo -e "${RED}Uptime system:${RESET}\n$UPTIME_SYSTEM"
echo -e "${RED}Number of Users connected to the system:${RESET}\n$NUMBER_USERS_CONNECTED"