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

Dir : /opt/sharedrads/
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/lastcommcache.sh

#!/bin/bash
# Shared RADS Tools, written by Erik Soroka (eriks@imhadmin.net, ext 834)
# this script gets executed by crontab to collect sa accounting data for use by RADS tools

#####################################################################
### COLLECT AND ARCHIVE PROCESS ACCOUNTING DATA HERE
#####################################################################

if [ -d /opt/sharedrads ]; then
    RECENTCP=/opt/sharedrads/recent-cp
else
    RECENTCP=/opt/dedrads/recent-cp
fi

if [ -f /var/log/sa/rads/.lastcomm.lock ]; then
        CHECKLOCK=$(find /var/log/sa/rads/.lastcomm.lock -mmin +2 -name "*" -print)

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

fi

	touch /var/log/sa/rads/.lastcomm.lock
        echo -e "\033[40;37;2mCPU seconds for last 15m\033[0m" > /var/log/sa/rads/.lastcomm.cache
        $RECENTCP -n 10 2>/dev/null | egrep -v 'root|total' | awk '{print $2,$9,$10,"("$11")"}' | sed s/\|//g | grep "%" | sort -r -nk2 >> /var/log/sa/rads/.lastcomm.cache
	mv -f /var/log/sa/rads/.lastcomm.cache /var/log/sa/rads/lastcomm.cache
	LINES=`wc -l /var/log/sa/rads/lastcomm.cache | awk '{print $1}'`

if [ "$LINES" == "1" ]; then
	echo -e "[\033[31;1m PSACCT IS DISABLED\033[0m ]" >> /var/log/sa/rads/lastcomm.cache
fi

rm -f /var/log/sa/rads/.lastcomm.lock

## EOF ##