-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcompression-cron.sh
More file actions
35 lines (27 loc) · 1.92 KB
/
compression-cron.sh
File metadata and controls
35 lines (27 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
#----------------------------------------------------------------------------------
# EngineScript - A High-Performance WordPress Server Built on Ubuntu and Cloudflare
#----------------------------------------------------------------------------------
# Website: https://EngineScript.com
# GitHub: https://github.com/Enginescript/EngineScript
# License: GPL v3.0
#----------------------------------------------------------------------------------
# EngineScript Variables
source /usr/local/bin/enginescript/enginescript-variables.txt || { echo "Error: Failed to source /usr/local/bin/enginescript/enginescript-variables.txt" >&2; exit 1; }
source /home/EngineScript/enginescript-install-options.txt || { echo "Error: Failed to source /home/EngineScript/enginescript-install-options.txt" >&2; exit 1; }
# Source shared functions library
source /usr/local/bin/enginescript/scripts/functions/shared/enginescript-common.sh || { echo "Error: Failed to source /usr/local/bin/enginescript/scripts/functions/shared/enginescript-common.sh" >&2; exit 1; }
#----------------------------------------------------------------------------------
# Start Main Script
#----------------------------------------------------------------------------
# Scan the entire /var/www/sites directory, which will include all WordPress sites installed on your server.
# When the filetypes match (html,css,js,json,xml,svg), brotli and gzip will compress using the strongest compression.
# This pre-compression allows the broli and gzip static functions to work within Nginx
# Brotli Compression
#find /var/www/sites -type f -a \( -name '*.html' -o -name '*.css' -o -name '*.js' \
#-o -name '*.json' -o -name '*.xml' -o -name '*.svg' \) \
#-exec brotli -kfZ {} \+
# GZip Compression
find /var/www/sites -type f -a \( -name '*.html' -o -name '*.css' -o -name '*.js' \
-o -name '*.json' -o -name '*.xml' -o -name '*.svg' \) \
-exec gzip -f --best -k {} \+