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/check_secs

#!/bin/bash
# Shared RADS Tools, written by Erik Soroka (eriks@imhadmin.net, ext 834)

#####################################################################
### DISPLAY CPU SECONDS LIVE
#####################################################################

echo

#load functions + banners
if [ -f /opt/sharedrads/radsfunctions.sh ]; then
    source /opt/sharedrads/radsfunctions.sh
else
    source /opt/dedrads/radsfunctions.sh
fi
smradsbanner


if [ -f /var/log/sa/rads/.lastcomm.lock ]; then
       	# remove any stale lock file (it should never be older than 1 minute)
        CHECKLOCK=$(find /var/log/sa/rads/.lastcomm.lock -mmin +2 -name "*" -print)

        if [ "$CHECKLOCK" == "" ]; then
		echo
        else
            	rm -f /var/log/sa/rads/.lastcomm.lock
        fi
fi


echo
echo -n " Please wait."
echo -e "\033[40;37;2m CPU usage: `date +%H`:00-`date +%H:%M` \033[0m" > /var/log/sa/rads/.lastcomm.cache

while [ -f /var/log/sa/rads/.lastcomm.lock ] ;
do
	RUNNING=TRUE
	echo -n "."
        sleep 5.5
done

	echo -n ".."

	if [ "$RUNNING" == "TRUE" ]; then
		#we already have up to the minute data, just show the cache
		echo
		echo
		cat /var/log/sa/rads/lastcomm.cache
		echo
		exit 0
	fi

#lock it up
touch /var/log/sa/rads/.lastcomm.lock

#get list of users
userlist=$(/usr/sbin/sa -cm | egrep -v 'root|nobody' | head -21 | tail -20 | awk '{ print $1 }')

       	echo -n ".."

for acct in $userlist; \
do
echo -n -e "$acct cp sec: "; /usr/bin/lastcomm $acct | grep "`date +%b\ %e\ %H`" \
| awk '{TOTAL+=$(NF-5)}END{print TOTAL}'
done | egrep -v ': 0$' | sort -nk4 -r | head -15 >>/var/log/sa/rads/.lastcomm.cache

	echo -n ".."

mv -f /var/log/sa/rads/.lastcomm.cache /var/log/sa/rads/lastcomm.cache

echo
echo
cat /var/log/sa/rads/lastcomm.cache
echo

#remove the lock
rm -f /var/log/sa/rads/.lastcomm.lock

echo

## EOF ##