PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /opt/sharedrads/oldrads/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //opt/sharedrads/oldrads/trend_disk

#!/bin/bash
# This script shows the available disk space for the month on a given shared server
# written by Erik S.  ext 834 e@inmotion.net

#lets set some important variables
SESSIONID=`date +%s`
MONTH=`date '+%b'`
FULLMONTH=`date '+%B'`
DAY=`date '+%d'`
HOUR=`date '+%H'`
TODAY=$DAY
OURSERVER=`hostname -s`

if [ -f /opt/sharedrads/radsfunctions.sh ]; then
    source /opt/sharedrads/radsfunctions.sh
else
    source /opt/dedrads/radsfunctions.sh
fi

#if we got a flag passed, skip the fanciness
	if [ -z "$1" ]; then

		if [ "$RADSCOLORS" == "off" ];
		then
		        radsbanner-nocolor
		else
		        radsbanner
		fi

	echo "    SHOWING DAILY AVAILABLE DISK SPACE TREND IN MEGABYTES(MB) FOR THIS MONTH" ; echo

	fi

cat /var/log/sa/rads/diskavail/* | awk '
BEGIN { printf "%-7s %-20s %-20s %-30s\n", "DAY", "PREVIOUS", "CURRENT", "CHANGE +/-"; }

{
	if (NR==1) { previous = $2; }
	current=$2;
	rateofchange = current - previous;
	printf "%-7s %-20s %-20s %-30s\n",NR,(previous/1024),(current/1024),(rateofchange/1024);
	#printf "%s ",(rateofchange/1024)/1024;
	previous = current  ;
}
END{ printf "\n"; }
' | head -`expr $DAY + 1` > /tmp/.$SESSIONID

AVGDAILY=`cat /tmp/.$SESSIONID | grep -v CHANGE | awk '{ SUM += $4 } END { print SUM/$1 }'`

if [ "$1" == "--avg" ]; then
	echo "$OURSERVER $AVGDAILY MB/day (average)"
	exit 0
else
	cat /tmp/.$SESSIONID
	echo
	echo "  The average disk trend for $FULLMONTH is: $AVGDAILY MB/day"
	echo
fi

rm -f /tmp/.$SESSIONID #cleanup