From 1a73c69781b14b6cd67ae9965c34a26580cb36b1 Mon Sep 17 00:00:00 2001 From: Bryan Roessler Date: Wed, 20 Oct 2021 15:04:51 -0400 Subject: [PATCH] Bug fixes --- script-install-motd | 20 +++++++++++++++----- script-user-add | 3 +++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/script-install-motd b/script-install-motd index 3e6e8237..588e631b 100644 --- a/script-install-motd +++ b/script-install-motd @@ -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 $? \ No newline at end of file diff --git a/script-user-add b/script-user-add index c604c4b1..77edddff 100755 --- a/script-user-add +++ b/script-user-add @@ -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 $?