Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/exe_root.../opt/sharedra...
File: lastcommcache.sh
#!/bin/bash
[0] Fix | Delete
# Shared RADS Tools, written by Erik Soroka (eriks@imhadmin.net, ext 834)
[1] Fix | Delete
# this script gets executed by crontab to collect sa accounting data for use by RADS tools
[2] Fix | Delete
[3] Fix | Delete
#####################################################################
[4] Fix | Delete
### COLLECT AND ARCHIVE PROCESS ACCOUNTING DATA HERE
[5] Fix | Delete
#####################################################################
[6] Fix | Delete
[7] Fix | Delete
if [ -d /opt/sharedrads ]; then
[8] Fix | Delete
RECENTCP=/opt/sharedrads/recent-cp
[9] Fix | Delete
else
[10] Fix | Delete
RECENTCP=/opt/dedrads/recent-cp
[11] Fix | Delete
fi
[12] Fix | Delete
[13] Fix | Delete
if [ -f /var/log/sa/rads/.lastcomm.lock ]; then
[14] Fix | Delete
CHECKLOCK=$(find /var/log/sa/rads/.lastcomm.lock -mmin +2 -name "*" -print)
[15] Fix | Delete
[16] Fix | Delete
if [ "$CHECKLOCK" == "" ]; then
[17] Fix | Delete
exit 0
[18] Fix | Delete
else
[19] Fix | Delete
rm -f /var/log/sa/rads/.lastcomm.lock
[20] Fix | Delete
fi
[21] Fix | Delete
[22] Fix | Delete
fi
[23] Fix | Delete
[24] Fix | Delete
touch /var/log/sa/rads/.lastcomm.lock
[25] Fix | Delete
echo -e "\033[40;37;2mCPU seconds for last 15m\033[0m" > /var/log/sa/rads/.lastcomm.cache
[26] Fix | Delete
$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
[27] Fix | Delete
mv -f /var/log/sa/rads/.lastcomm.cache /var/log/sa/rads/lastcomm.cache
[28] Fix | Delete
LINES=`wc -l /var/log/sa/rads/lastcomm.cache | awk '{print $1}'`
[29] Fix | Delete
[30] Fix | Delete
if [ "$LINES" == "1" ]; then
[31] Fix | Delete
echo -e "[\033[31;1m PSACCT IS DISABLED\033[0m ]" >> /var/log/sa/rads/lastcomm.cache
[32] Fix | Delete
fi
[33] Fix | Delete
[34] Fix | Delete
rm -f /var/log/sa/rads/.lastcomm.lock
[35] Fix | Delete
[36] Fix | Delete
## EOF ##
[37] Fix | Delete
[38] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function