Last active
April 23, 2019 04:24
-
-
Save mdpuma/27a15043bc2fa083e4e805dbbd1678f5 to your computer and use it in GitHub Desktop.
cpanel useful commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # change ip address for accounts (included DNS records) | |
| grep $OLD_IP /var/cpanel/users/* | cut -d: -f1 | xargs -n1 basename | xargs -tI{} /usr/local/cpanel/bin/setsiteip -u {} $NEW_IP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -xe | |
| IFS="," | |
| cat iplist.txt | while read -r ip user; do | |
| /usr/local/cpanel/bin/setsiteip -u $user $ip | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # standard ftp server which is included with cPanel have limit on files shown by command ls | |
| # https://linux.die.net/man/8/pure-ftpd | |
| # -L max files:max depth | |
| # Avoid denial-of-service attacks by limiting the number of displayed files in a 'ls' and the maximum depth of a recursive 'ls'. | |
| # Defaults are 2000:5 (2000 files displayed for a single 'ls' and walk through 5 subdirectories max). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Enable shell access for account from SSH, without accessing web WHM | |
| whmapi1 modifyacct user=USER shell=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # show mysql databases usage by accounts | |
| cd /var/lib/mysql; | |
| ls | cut -d_ -f1 | sort -u | while read i; do | |
| SIZE="`du -chsBM $i* | grep total | awk '{ print $1 }'`"; | |
| echo "$i: $SIZE"; | |
| done | sort -k2 -n | |
| # show mysql databases count by accounts | |
| cd /var/lib/mysql; | |
| ls | cut -d_ -f1 | sort -u | while read i; do | |
| COUNT="`ls -d $i* | wc -l`"; | |
| echo "$i: $COUNT"; | |
| done | sort -k2 -n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| cat /etc/userdomains | cut -d: -f2 | sort -u | xargs -I{} cl-quota -S 150000 -H 150000 -u {} | |
| cl-quota -P | sed -E 's/\s{2,}/,/g' | cut -d ',' -f2 | xargs -tI{} cl-quota -S 150000 -H 150000 -p '{}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| /usr/local/cpanel/scripts/update_local_rpm_versions --edit target_settings.munin unmanaged |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # run this | |
| /usr/local/cpanel/bin/checkallsslcerts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment