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 / mysql
Created July 11, 2019 09:33
MariaDB etc/init.d/mysql
#!/bin/sh
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
# This file is public domain and comes with NO WARRANTY of any kind
# MariaDB daemon start/stop script.
# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
# When this is done the mysql server will be started when the machine is
# started and shut down when the systems goes down.
@cPLevey
cPLevey / clamav.cf
Created June 22, 2019 01:40
ClamAV SpamAssassin Plugin Files
loadplugin ClamAV clamav.pm
full CLAMAV eval:check_clamav()
describe CLAMAV Clam AntiVirus detected a virus
score CLAMAV 10
add_header all Virus _CLAMAVRESULT_
@cPLevey
cPLevey / ami_repo_fetch.sh
Created December 13, 2016 16:21
Fetch AMI repodata
#!/bin/sh
for REPOFILE in {repomd.xml,comps.xml,updateinfo.xml.gz,primary.sqlite.bz2}; do
echo "Fetching $REPOFILE";
curl -s "http://packages.us-east-1.amazonaws.com/2016.09/main/20160901f6a8/x86_64/repodata/$REPOFILE?instance_id=i-037c593f14c853b59&region=us-east-1" > $REPOFILE
done
@cPLevey
cPLevey / ea5740.patch
Created December 7, 2016 00:34
Quick .patch for EA-5740
--- migrate_ea3_to_ea4 2016-11-09 04:14:57.701999985 -0600
+++ migrate_ea3_to_ea4.patched 2016-12-06 18:24:00.573980212 -0600
@@ -41,10 +41,17 @@
use Cpanel::FindBin ();
use Cpanel::SafeRun::Full ();
+use Cpanel::DNSONLY ();
+
use POSIX qw{:sys_wait_h};
# 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.
#
#
# 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.
#
@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
#!/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 / 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');
@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]