Skip to content

Instantly share code, notes, and snippets.

View jdeathe's full-sized avatar
💭
Taking a break from development projects to focus other things

James Deathe jdeathe

💭
Taking a break from development projects to focus other things
View GitHub Profile
@jdeathe
jdeathe / kernel-update-with-fast-boot-via-kexec.md
Last active September 17, 2023 20:37
Kernel Update with Fast-Boot via kexec

Kernel Update with Fast Boot via kexec

# <-- NOTE: This represents the command prompt of a root user

Identify the latest installed kernel

# kernel_release_default="$(
 grubby --default-kernel \
@jdeathe
jdeathe / debug-rsyslog-on-systemd-based-platforms.md
Last active March 23, 2021 08:50
Debug RSyslog on RHEL, CentOS, Oracle Linux (el7/el8 platform)
@jdeathe
jdeathe / cloud-config-docker-el7.yml
Last active April 6, 2021 13:29
Cloud-Init user-data to install Docker on CentOS-7
#cloud-config
---
timezone: "UTC"
write_files:
- path: "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7"
permissions: "0644"
owner: "root:root"
content: |
-----BEGIN PGP PUBLIC KEY BLOCK-----
@jdeathe
jdeathe / php-curl-status.php
Last active February 8, 2019 19:45
Basic health status check using PHP curl
<?php
$responseCode = 500;
$responseCodeOk = 200;
$responseCodeFail = 503;
$url = 'https://www.deathe.org/';
$ch = curl_init();
curl_setopt_array(
@jdeathe
jdeathe / file-listing-by-date.md
Last active October 2, 2018 10:14
Linux / Simple File List for Review

Generate a File Listing for Review

Fields

  • Last Modified
  • Size (bytes)
  • Relative Path

Command

Replace {{search-path}} with the path to search.

@jdeathe
jdeathe / identify-php-cgi-process-memory-usage.md
Last active September 25, 2018 09:59
Identify PHP FastCGI Process Memory Usage

Identify PHP FastCGI Process Memory Usage

pmap -x $(ps ax \
  | grep php-cgi \
  | grep -v grep \
  | awk '{ print $1 }' \
  | awk -v RS='' '{ gsub("\n", " "); print; }'\
) | grep -E '^(Address|total)'
@jdeathe
jdeathe / mysql-query-logging.md
Last active July 20, 2018 08:40
How to Enable MySQL Query Logging at Runtime

How to Enable MySQL Query Logging at Runtime

From the mysql client run:

mysql> SET GLOBAL general_log=true;
mysql> SET GLOBAL general_log_file='general.log';

After this queries will be logged to the named file located in the MySQL data directory. e.g. /var/lib/mysql/general.log.

@jdeathe
jdeathe / centos-6-php-ius-audit.md
Created June 8, 2018 10:51
Identify Unavailable IUS Packages Between PHP 5.6 and 7.1

Identify Unavailable IUS PHP Packages Between 5.6 and 7.1

For all installed packages prefixed with php56u, check for availability php71u package.

# yum list installed \
| grep -o '^php56u[^ ]*' \
| { \
  mapfile -t packages; \
 for package in "${packages[@]}"; do \
@jdeathe
jdeathe / get-apache-namevhost-alias-to-configs.md
Created May 30, 2018 18:38
BASH one liner to output Apache config files for NameVirtualHosts

The output of apachectl -S is really useful but it's not easy to parse in a script. To make it easier to find the configuration file for a given NameVirtualHost host the following BASH one liner returns lines of output that can be easily parsed.

# apachectl -S 2>&1 \
| sed -rn -e '/NameVirtualHost$/,$ { /NameVirtualHost$/d; $ d; p; }' \
| sed -rn -e 's/^.*(port ([0-9]+) namevhost|alias) ([^ ]*)( )?(\((.*):[0-9]+\)|$)/\2 \6\n\3/p' \
| sed -r -e '/^$/d' -e 's/(.*\.conf$)/\n\1/g' \
| awk -vRS='' '$1=$1' \
| sort -n \
| uniq
@jdeathe
jdeathe / centos-wildcard-certbot.md
Last active November 29, 2021 10:33
Installation and Usage of Certbot on CentOS to Obtain a Let’s Encrypt Wildcard TLS/SSL Certificate.

Requesting a Wildcard Certificate with Certbot on CentOS

To request a Let's Encrypt wildcard certificate there are the following prerequisites:

  • The client must support ACME v2 (i.e Certbot >= 0.22.0)
  • The DNS-01 challenge type must be used.
  • The --server option or configuration directive must be changed to the appropriate v2 endpoint.

Installation

Install certbot-auto