second commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
hostname=$(hostname -s)
|
||||
number=$(echo $hostname | grep -oP '[0-9]*$')
|
||||
hostname=${hostname%"$number"}
|
||||
rows=9
|
||||
|
||||
case $hostname in
|
||||
'prod')
|
||||
#print in RED
|
||||
echo -ne "\033[31;1m"
|
||||
;;
|
||||
'beta')
|
||||
rows=7
|
||||
#print in ORANGE
|
||||
echo -ne "\033[33;1m"
|
||||
;;
|
||||
'dev')
|
||||
rows=7
|
||||
#print in GREEN
|
||||
echo -ne "\033[33;1m"
|
||||
;;
|
||||
*)
|
||||
#print in GREEN
|
||||
echo -ne "\033[32;1m"
|
||||
;;
|
||||
esac
|
||||
|
||||
fullname="$hostname $number"
|
||||
figlet -f big "$fullname" | head -n$rows
|
||||
echo -ne "\033[0m"
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
FQDN=$(hostname --fqdn)
|
||||
IP_ADDRESS=$(hostname -I | cut -d ' ' -f1)
|
||||
DISTRO=$(lsb_release -d | cut -f2)
|
||||
KERNEL=$(uname -srm)
|
||||
UPTIME=$(uptime | awk -F'( |,|:)+' '{if ($7=="min") m=$6; else {if ($7~/^day/) {d=$6;h=$8;m=$9} else {h=$6;m=$7}}} {print d+0,"days"}')
|
||||
LOAD=$(cat /proc/loadavg)
|
||||
|
||||
echo "FQDN : $FQDN"
|
||||
echo "UPTIME: $UPTIME"
|
||||
echo "IPADDR: $IP_ADDRESS"
|
||||
echo "DISTRO: $DISTRO"
|
||||
echo "KERNEL: $KERNEL"
|
||||
echo "LOAD : $LOAD"
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
USERS=$(
|
||||
w -uh
|
||||
)
|
||||
|
||||
if [ -n "$USERS" ]; then
|
||||
echo '-----------------------------------------------'
|
||||
echo -e "${RED}Beware,${NC} there is another connected user${RED}"
|
||||
echo "$USERS"
|
||||
echo -e "${NC}-----------------------------------------------"
|
||||
fi
|
||||
Reference in New Issue
Block a user