Bug fixes

This commit is contained in:
2021-10-20 15:04:51 -04:00
parent 670daf4880
commit 1a73c69781
2 changed files with 18 additions and 5 deletions

View File

@@ -14,16 +14,20 @@ profiledir="/etc/profile.d/"
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')
MEMORY1=$(free -t -m | grep "buffers/cache" | awk '{print $3" MB";}')
MEMORY2=$(free -t -m | grep "Mem" | awk '{print $2" MB";}')
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))
@@ -36,6 +40,14 @@ LOAD1=$(awk {'print $1'} /proc/loadavg)
LOAD5=$(awk {'print $2'} /proc/loadavg)
LOAD15=$(awk {'print $3'} /proc/loadavg)
echo "
_ _ _ _ _
| | | | __ _ _ __| |_ _ __ ___ __ _ _ __ | | __ _| |__
| |_| |/ _` | '__| __| '_ ` _ \ / _` | '_ \ | | / _` | '_ \
| _ | (_| | | | |_| | | | | | (_| | | | | | |__| (_| | |_) |
|_| |_|\__,_|_| \__|_| |_| |_|\__,_|_| |_| |_____\__,_|_.__/
"
echo "
===========================================================================
- Hostname............: $HOSTNAME
@@ -44,8 +56,7 @@ echo "
===========================================================================
- Current user........: $USER
- CPU usage...........: $LOAD1, $LOAD5, $LOAD15 (1, 5, 15 min)
- Memory used.........: $MEMORY1 / $MEMORY2
- Swap in use.........: $(free -m | tail -n 1 | awk '{print $3}') MB
- Memory used.........: $MEMUSED / $MEMTOTAL
- Processes...........: $PSA running
- System uptime.......: $upDays days $upHours hours $upMins minutes $upSecs seconds
- Disk space ROOT.....: $ROOT remaining
@@ -55,6 +66,5 @@ echo "
"
EOF
chmod +x "$profiledir/motd.sh"
exit $?

View File

@@ -47,4 +47,7 @@ start_gid=$(( last_gid + id_offset ))
echo "$username:$start_uid:$id_num" >> /etc/subuid
echo "$username:$start_gid:$id_num" >> /etc/subgid
# Copy manual to user desktop
ln -s README.pdf /home/"$user"/Desktop/README.pdf
exit $?