Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# Script by cPFence Team, https://cpfence.app
mysql -e "show variables; show status" | awk '
{
VAR[$1]=$2
}
END {
MAX_CONN = VAR["max_connections"]
MAX_USED_CONN = VAR["Max_used_connections"]
BASE_MEM=VAR["key_buffer_size"] + VAR["query_cache_size"] + VAR["innodb_buffer_pool_size"] + VAR["innodb_additional_mem_pool_size"] + VAR["innodb_log_buffer_size"]
#!/bin/bash
################################################################################
# BTRFS Backup Script for Enhance Backup Server
#
# Overview:
# This script facilitates the efficient backup of website data stored on an
# Enhance Backup Server utilizing the BTRFS filesystem. It performs the
# following operations for each website directory:
# 1. Synchronizes the live state (`backup-subvolume`) to the destination server.
#!/bin/bash
# Script by cPFence Team, https://cpfence.app
#
# Description:
# This script performs routine server maintenance tasks:
# - Truncates user error logs larger than 5MB and server logs larger than 100MB, keeping only the last entries using `sponge` (ensure `sponge` is installed on the server).
# - Retains only the last 10 days of system journal logs.
# - Updates and upgrades packages non-interactively and checks if a reboot is required.
# - Clears APT cache to save space.
#!/bin/bash
# Written by: cPFence Team / https://cpfence.app/
#
# Description:
# This script is designed to automate the optimization and configuration of OpenLiteSpeed
# running inside a Docker container or directly on the host. It backs up the existing
# configuration file, applies updates to critical server settings such as worker processes,
# CPU affinity, memory buffer sizes, and external application configurations for PHP-LSAPI.
# MD5 checksum validation is added to detect changes and prevent redundant updates.