Skip to content

Instantly share code, notes, and snippets.

View cPLevey's full-sized avatar

David Levey cPLevey

  • cPanel, Inc.
  • Houston, TX
View GitHub Profile
@cPLevey
cPLevey / cpanel-update-mode.sh
Created February 17, 2016 08:04
Check cPanel Update Mode #cPanel #updates #upcp
grep UPDATES /etc/cpupdate.conf
@cPLevey
cPLevey / tail-cpanel-update
Created February 17, 2016 08:06
Tail Latest cPanel Update #upcp #update #cPanel
tail -f /var/cpanel/updatelogs/last
@cPLevey
cPLevey / outgoing_mail_suspended_users.sh
Last active May 6, 2016 07:22
outgoing_mail_suspended_users fix
#!/bin/sh
# Quick fix script for CPANEL-5806
# Ver. 0.05
CMP_ERROR_COUNT=$(grep 'check_mail_permissions' /var/log/exim_mainlog |wc -l);
CREATED_FILE=0;
if [ "$CMP_ERROR_COUNT" -ne "0" ]; then
echo "$CMP_ERROR_COUNT errors found in the exim main log referencing a check_mail_permissions issue.";
echo "Example(s):";
echo "===========";
grep 'check_mail_permissions' /var/log/exim_mainlog |tail -n10;
@cPLevey
cPLevey / slowdown-upcp.hook
Created June 10, 2016 07:24
Site5 cPanel Update "Slowdown" Hook
#!/bin/bash
# Pre-upcp hook which will deny upcp in case the server already has IO,
# chef-client, cdp etc. are running..!
# Story: https://wwwhosting.atlassian.net/browse/SH-222
# Set limit load avg. for VPS/hardware
# Defaults to 6 for VPS and 10 for hardware ones
if [[ $(/sbin/lspci | wc -l) -eq 0 ]]; then
limit_load=6
@cPLevey
cPLevey / main.local.patch
Created July 29, 2016 05:19
Hostname SSL Apache 2.4 Template Diff Ouput
--- main.default 2016-06-23 13:19:00.883000238 +0000
+++ main.local 2016-07-29 05:15:36.027000098 +0000
@@ -445,7 +445,7 @@
[%- END %]
RewriteEngine On
RewriteCond %{HTTP_HOST} !^[% wildcard_safe(servername) %]$
- RewriteCond %{HTTP_HOST} ^cpanel.
+ ## RewriteCond %{HTTP_HOST} ^cpanel. ## REMOVED
RewriteRule ^/(.*) http://127.0.0.1:2082/$1 [P]
@cPLevey
cPLevey / cmsverso.sh
Last active August 2, 2016 04:09
CMS Versions - Out of Date Checker
#!/bin/sh
HTTPDROOT=$(httpd -V 2>/dev/null |grep HTTPD_ROOT |awk '{gsub("-D HTTPD_ROOT=", "");gsub(/"/, "");gsub(" ","");print}');
HTTPDCONF=$(httpd -V 2>/dev/null |grep SERVER_CONFIG_FILE |awk '{gsub("-D SERVER_CONFIG_FILE=", "");gsub(/"/, "");gsub(" ", "");print}');
CONFPATH=$(echo $HTTPDROOT/$(echo $HTTPDCONF));
if [ -d "/etc/httpd/conf/plesk.conf.d/vhosts/" ]; then
DOCROOTS=$(grep -RPo --no-filename '\/var\/www\/vhosts\/(.*)\/httpdocs' /var/www/vhosts/system/*/conf/ | uniq);
else
DOCROOTS=$(grep "DocumentRoot" $CONFPATH |awk '{gsub(" DocumentRoot ", "");print}');
fi;
LATESTVERSINFO=$(curl -s 'http://repo.servergur.us/sshtool/server_crons/cms_latest');
#!/bin/sh
mkdir -p /var/lib/rpm/corrupt.dbs;
find /var/lib/rpm/ -maxdepth 1 -type f -name '__db.*' -exec mv {} /var/lib/rpm/corrupt.dbs/ \;
echo "Moved corrupt dbs. Rebuilding dbs now.";
rpm --rebuilddb;
echo "Complete."
@cPLevey
cPLevey / phpinfo_gen.sh
Last active August 17, 2016 08:12
make a PHP info file
#!/bin/sh
PHPINFO_NAME='cpsupport_phpinfo.php';
echo "";
cat << EOF > "$PHPINFO_NAME"
<?php
// Added by cPanel Support for Ticket Assistance.
phpinfo();
phpinfo(INFO_MODULES);
?>
EOF
#
# Directives controlling the display of server-generated directory listings.
#
# Required modules: mod_authz_core, mod_authz_host,
# mod_autoindex, mod_alias
#
# To see the listing of a directory, the Options directive for the
# directory must include "Indexes", and the directory must not contain
# a file matching those listed in the DirectoryIndex directive.
#
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#