Fix rename

This commit is contained in:
2021-10-20 15:09:35 -04:00
parent 28235ee07f
commit becd7e78ce

66
script-install-banner Normal file
View File

@@ -0,0 +1,66 @@
#!/usr/bin/env bash
# Install motd scripts
[[ -f functions ]] && . functions || exit 1
is_root
profiledir="/etc/profile.d/"
[[ ! -d "$profiledir" ]] && mkdir -p "$profiledir"
cat <<- 'EOF' > "$profiledir/motd.sh"
#!/usr/bin/env bash
[[ -v NO_MOTD ]] && exit 0
USER=$(whoami)
HOSTNAME=$(uname -n)
ARRAY=$(df -Ph | grep array | awk '{print $4}' | tr -d '\n')
ROOT=$(df -Ph | grep sdb3 | awk '{print $4}' | tr -d '\n')
BACKUP=$(df -Ph | grep backup | awk '{print $4}' | tr -d '\n')
MEMUSED=$(free -t -m | grep "Mem:" | awk '{print $3" MB";}')
MEMTOTAL=$(free -t -m | grep "Mem:" | awk '{print $2" MB";}')
PSA=$(ps -Afl | wc -l)
SWAPMEM=$(free -m | tail -n 1 | awk '{print $3}')
#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
LOAD1=$(awk {'print $1'} /proc/loadavg)
LOAD5=$(awk {'print $2'} /proc/loadavg)
LOAD15=$(awk {'print $3'} /proc/loadavg)
echo "
🄷🄰🅁🅃🄼🄰🄽 🄻🄰🄱
"
echo "
===========================================================================
- Hostname............: $HOSTNAME
- Release.............: $(cat /etc/redhat-release)
- Users...............: Currently $(users | wc -w) user(s) logged on
===========================================================================
- Current user........: $USER
- CPU usage...........: $LOAD1, $LOAD5, $LOAD15 (1, 5, 15 min)
- Memory used.........: $MEMUSED / $MEMTOTAL
- Processes...........: $PSA running
- System uptime.......: $upDays days $upHours hours $upMins minutes $upSecs seconds
- Disk space ROOT.....: $ROOT remaining
- Disk space ARRAY....: $ARRAY remaining
- Disk space BACKUP...: $BACKUP remaining
===========================================================================
"
EOF
exit $?