Skip to content

Instantly share code, notes, and snippets.

@bahadoribnm
bahadoribnm / gist:7557ccaf8679dd9f1de70f679ebd0283
Created May 18, 2021 06:08
Script to check cPanel CPU and Memory usage for a specific user
domain="thedomain.com"; for i in `seq 1 7 `; do let i=$i+1 ; let k=$i-1 ; let s="$(date +%s) - (k-1)*86400"; let t="$(date +%s) - (k-2)*86400"; echo `date -Idate -d @$s`; /usr/local/cpanel/bin/dcpumonview `date -d @$s +%s` `date -d @$t +%s` | sed -r -e 's@^<tr bgcolor=#[[:xdigit:]]+><td>(.*)</td><td>(.*)</td><td>(.*)</td><td>(.*)</td><td>(.*)</td></tr>$@Account: \1\tDomain: \2\tCPU: \3\tMem: \4\tMySQL: \5@' -e 's@^<tr><td>Top Process</td><td>(.*)</td><td colspan=3>(.*)</td></tr>$@\1 - \2@' | grep $domain -A3 ; done
@bahadoribnm
bahadoribnm / versions.sh
Last active August 31, 2022 05:35
Bash script to find Joomla and Wordpress versions in cPanel
#!/bin/bash
find /home/*/public_html/libraries/cms/* -type f -name 'version.php' |\
while read filepath;
do
#version=$(cat $filepath |grep -Po "const RELEASE = '\K[^']*");
#[ ! -z version ] && echo $(echo $filepath |cut -d "/" -f 3) $version >> joomla.version
echo $(echo $filepath |cut -d "/" -f 3) $(cat $filepath |grep -Po "const RELEASE = '\K[^']*") >> joomla.version
done;