Skip to content

Commit dcfe35d

Browse files
committed
Major Update
- Added support for Amazon S3 cloud backup. - Fully revised the cron backups for local, dropbox, and s3. - Changed cron firing times. - Added a cron to scan the uploads directory for potentially unwanted .php files. - Added new commands that can run from the terminal. - Added preinstall checks. - Changed mysql default character set to utf8mb4
1 parent 4a55b7c commit dcfe35d

57 files changed

Lines changed: 1045 additions & 271 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ Follow this tutorial exactly: **https://gist.github.com/isaumya/af10e4855ac83156
187187
### EngineScript Commands
188188
|Command |Function |
189189
|-------------------|-------------------------------|
190+
|**`es.backup`** |Runs the backup script to backup all domains locally and in the cloud (optional) |
190191
|**`es.cache`** |Clear FastCGI Cache, OpCache, and Redis *(server-wide)* |
192+
|**`es.config`** |Opens the configuration file in the Nano text editor |
191193
|**`es.optimize`** |Losslessly compress all images in the WordPress /uploads directory *(server-wide)* |
192194
|**`es.menu`** |EngineScript menu |
193195
|**`es.restart`** |Restart Nginx and PHP |

enginescript-install.sh

Lines changed: 145 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@ dos2unix /home/EngineScript/enginescript-install-options.txt
2828
# In-case you changed any files and changed Permissions
2929
find /usr/local/bin/enginescript -type d,f -exec chmod 755 {} \;
3030
chown -R root:root /usr/local/bin/enginescript
31+
find /usr/local/bin/enginescript -type f -iname "*.sh" -exec chmod +x {} \;
3132

3233
# EngineScript Variables
3334
source /usr/local/bin/enginescript/enginescript-variables.txt
3435
source /home/EngineScript/enginescript-install-options.txt
3536

3637
# Reboot Warning
37-
echo -e "ATTENTION\n\nServer needs to reboot at the end of this script.\nEnter command es.menu after reboot to continue.\n\nScript will continue in 5 seconds..." | boxes -a c -d shell -p a1l2
38+
echo -e "\nATTENTION:\n\nServer needs to reboot at the end of this script.\nEnter command es.menu after reboot to continue.\n\nScript will continue in 5 seconds..." | boxes -a c -d shell -p a1l2
3839
sleep 5
3940

4041
if [ "${SERVER_MEMORY_TOTAL_80}" -lt 1000 ];
@@ -45,7 +46,140 @@ if [ "${SERVER_MEMORY_TOTAL_80}" -lt 1000 ];
4546
echo "You may need to manually change memory limits in PHP and MariaDB."
4647
sleep 10
4748
else
48-
echo "80% of total server memory: ${SERVER_MEMORY_TOTAL_80}"
49+
echo "Memory Test: 80% of total server memory: ${SERVER_MEMORY_TOTAL_80}"
50+
fi
51+
52+
# Configuration File Check
53+
echo -e "${BOLD}\n\n--------------------\nConfiguration Review\n--------------------${NORMAL}"
54+
echo -e "${BOLD}\nServer Information:${NORMAL}"
55+
echo "Variables File Date = $VARIABLES_DATE"
56+
echo "Script Run Date = $DT"
57+
echo "CPU Count = $CPU_COUNT"
58+
echo "32bit or 64bit = $BIT_TYPE"
59+
echo "Server Memory = $SERVER_MEMORY_TOTAL_100"
60+
echo "IP Address = $IP_ADDRESS"
61+
echo "Linux Version = $LINUX_TYPE $UBUNTU_VER $UBUNTU_CODENAME"
62+
echo "Server Memory = $SERVER_MEMORY_TOTAL_100"
63+
echo -e "${BOLD}\nInstall Options:${NORMAL}"
64+
echo "AUTOMATIC_LOSSLESS_IMAGE_OPTIMIZATION = $AUTOMATIC_LOSSLESS_IMAGE_OPTIMIZATION"
65+
echo "AUTOMATIC_ENGINESCRIPT_UPDATES = $AUTOMATIC_ENGINESCRIPT_UPDATES"
66+
echo "INSTALL_ADMINER = $INSTALL_ADMINER"
67+
echo "INSTALL_PHYMYADMIN = $INSTALL_PHYMYADMIN"
68+
echo "INSTALL_WEBMIN = $INSTALL_WEBMIN"
69+
echo "SHOW_ENGINESCRIPT_HEADER = $SHOW_ENGINESCRIPT_HEADER"
70+
echo "DAILY_LOCAL_DATABASE_BACKUP = $DAILY_LOCAL_DATABASE_BACKUP"
71+
echo "HOURLY_LOCAL_DATABASE_BACKUP = $HOURLY_LOCAL_DATABASE_BACKUP"
72+
echo "WEEKLY_LOCAL_WPCONTENT_BACKUP = $WEEKLY_LOCAL_WPCONTENT_BACKUP"
73+
echo "INSTALL_S3_BACKUP = $INSTALL_S3_BACKUP"
74+
echo "DAILY_S3_DATABASE_BACKUP = $DAILY_S3_DATABASE_BACKUP"
75+
echo "HOURLY_S3_DATABASE_BACKUP = $HOURLY_S3_DATABASE_BACKUP"
76+
echo "WEEKLY_S3_WPCONTENT_BACKUP = $WEEKLY_S3_WPCONTENT_BACKUP"
77+
echo "INSTALL_DROPBOX_BACKUP = $INSTALL_DROPBOX_BACKUP"
78+
echo "DAILY_DROPBOX_DATABASE_BACKUP = $DAILY_DROPBOX_DATABASE_BACKUP"
79+
echo "HOURLY_DROPBOX_DATABASE_BACKUP = $HOURLY_DROPBOX_DATABASE_BACKUP"
80+
echo "WEEKLY_DROPBOX_WPCONTENT_BACKUP = $WEEKLY_DROPBOX_WPCONTENT_BACKUP"
81+
echo -e "${BOLD}\nUser Credentials:${NORMAL}"
82+
echo "S3_BUCKET_NAME = $S3_BUCKET_NAME"
83+
echo "CF_GLOBAL_API_KEY = $CF_GLOBAL_API_KEY"
84+
echo "CF_ACCOUNT_EMAIL = $CF_ACCOUNT_EMAIL"
85+
echo "NGINX_USERNAME = $NGINX_USERNAME"
86+
echo "NGINX_PASSWORD = $NGINX_PASSWORD"
87+
echo "MARIADB_ADMIN_PASSWORD = $MARIADB_ADMIN_PASSWORD"
88+
echo "PHPMYADMIN_USERNAME = $PHPMYADMIN_USERNAME"
89+
echo "PHPMYADMIN_PASSWORD = $PHPMYADMIN_PASSWORD"
90+
echo "WEBMIN_USERNAME = $WEBMIN_USERNAME"
91+
echo "WEBMIN_PASSWORD = $WEBMIN_PASSWORD"
92+
echo "WP_ADMIN_EMAIL = $WP_ADMIN_EMAIL"
93+
echo "WP_ADMIN_USERNAME = $WP_ADMIN_USERNAME"
94+
echo "WP_ADMIN_PASSWORD = $WP_ADMIN_PASSWORD"
95+
echo "PUSHBULLET_TOKEN = $PUSHBULLET_TOKEN"
96+
echo "WORDFENCE_CLI_TOKEN = $WORDFENCE_CLI_TOKEN"
97+
echo "WPSCANAPI = $WPSCANAPI"
98+
echo -e "\n"
99+
sleep 5
100+
101+
# Check S3 Install
102+
if [ "$INSTALL_S3_BACKUP" = 1 ] && [ "$S3_BUCKET_NAME" = PLACEHOLDER ];
103+
then
104+
echo -e "\nWARNING:\n\nYou have set INSTALL_S3_BACKUP=1 but have not properly set S3_BUCKET_NAME.\nPlease return to the config file with command ${BOLD}es.config${NORMAL} and change S3_BUCKET_NAME to show your bucket name instead of PLACEHOLDER\nYou can also disabled S3 cloud backup by setting INSTALL_S3_BACKUP=0\n"
105+
exit
106+
fi
107+
108+
# Check S3 Bucket Name
109+
if [ "$INSTALL_S3_BACKUP" = 0 ] && [ "$S3_BUCKET_NAME" != PLACEHOLDER ];
110+
then
111+
echo -e "\nWARNING:\n\nYou have set INSTALL_S3_BACKUP=0 but have changed S3_BUCKET_NAME from PLACEHOLDER.\nPlease return to the config file with command ${BOLD}es.config${NORMAL} and change INSTALL_S3_BACKUP to 1. If this is a mistake, you can avoid this error by setting S3_BUCKET_NAME to PLACEHOLDER\n"
112+
exit
113+
fi
114+
115+
# Check Cloudflare Global API Key
116+
if [ "$CF_GLOBAL_API_KEY" = PLACEHOLDER ] && [ "$CF_ACCOUNT_EMAIL" = PLACEHOLDER ];
117+
then
118+
echo -e "\nWARNING:\n\nCF_GLOBAL_API_KEY is to PLACEHOLDER. EngineScript requires this be set prior to installation.\nPlease return to the config file with command ${BOLD}es.config${NORMAL} and change CF_GLOBAL_API_KEY to the correct value.\n"
119+
exit
120+
fi
121+
122+
# Check Cloudflare Account Email
123+
if [ "$CF_ACCOUNT_EMAIL" = PLACEHOLDER ];
124+
then
125+
echo -e "\nWARNING:\n\nCF_ACCOUNT_EMAIL is to PLACEHOLDER. EngineScript requires this be set prior to installation.\nPlease return to the config file with command ${BOLD}es.config${NORMAL} and change CF_ACCOUNT_EMAIL to the correct value.\n"
126+
exit
127+
fi
128+
129+
# Check MariaDB Password
130+
if [ "$MARIADB_ADMIN_PASSWORD" = PLACEHOLDER ];
131+
then
132+
echo -e "\nWARNING:\n\nMARIADB_ADMIN_PASSWORD is set to PLACEHOLDER. EngineScript requires this be set to a unique value.\nPlease return to the config file with command ${BOLD}es.config${NORMAL} and change MARIADB_ADMIN_PASSWORD to something more secure.\n"
133+
exit
134+
fi
135+
136+
# Check Nginx Username
137+
if [ "$NGINX_USERNAME" = PLACEHOLDER ];
138+
then
139+
echo -e "\nWARNING:\n\nNGINX_USERNAME is set to PLACEHOLDER. EngineScript requires this be set to a unique value.\nPlease return to the config file with command ${BOLD}es.config${NORMAL} and change NGINX_USERNAME to something more secure.\n"
140+
exit
141+
fi
142+
143+
# Check Nginx Password
144+
if [ "$NGINX_PASSWORD" = PLACEHOLDER ];
145+
then
146+
echo -e "\nWARNING:\n\nNGINX_PASSWORD is set to PLACEHOLDER. EngineScript requires this be set to a unique value.\nPlease return to the config file with command ${BOLD}es.config${NORMAL} and change NGINX_PASSWORD to something more secure.\n"
147+
exit
148+
fi
149+
150+
# Check phpMyAdmin Username
151+
if [ "$PHPMYADMIN_USERNAME" = PLACEHOLDER ];
152+
then
153+
echo -e "\nWARNING:\n\nPHPMYADMIN_USERNAME is set to PLACEHOLDER. EngineScript requires this be set to a unique value.\nPlease return to the config file with command ${BOLD}es.config${NORMAL} and change PHPMYADMIN_USERNAME to something more secure.\n"
154+
exit
155+
fi
156+
157+
# Check phpMyAdmin Password
158+
if [ "$PHPMYADMIN_PASSWORD" = PLACEHOLDER ];
159+
then
160+
echo -e "\nWARNING:\nPHPMYADMIN_PASSWORD is set to PLACEHOLDER. EngineScript requires this be set to a unique value.\nPlease return to the config file with command ${BOLD}es.config${NORMAL} and change PHPMYADMIN_PASSWORD to something more secure.\n"
161+
exit
162+
fi
163+
164+
# Check WordPress Admin Email
165+
if [ "$WP_ADMIN_EMAIL" = [email protected] ];
166+
then
167+
echo -e "\nWARNING:\n\nWP_ADMIN_EMAIL is set to [email protected]. EngineScript requires this be set to a unique value.\nPlease return to the config file with command ${BOLD}es.config${NORMAL} and change WP_ADMIN_EMAIL to a real email address.\n"
168+
exit
169+
fi
170+
171+
# Check WordPress Admin Username
172+
if [ "$WP_ADMIN_USERNAME" = PLACEHOLDER ];
173+
then
174+
echo -e "\nWARNING:\n\nWP_ADMIN_USERNAME is set to PLACEHOLDER. EngineScript requires this be set to a unique value.\nPlease return to the config file with command ${BOLD}es.config${NORMAL} and change WP_ADMIN_USERNAME to something more secure.\n"
175+
exit
176+
fi
177+
178+
# Check WordPress Admin Password
179+
if [ "$WP_ADMIN_PASSWORD" = PLACEHOLDER ];
180+
then
181+
echo -e "\nWARNING:\n\nWP_ADMIN_PASSWORD is set to PLACEHOLDER. EngineScript requires this be set to a unique value.\nPlease return to the config file with command ${BOLD}es.config${NORMAL} and change WP_ADMIN_PASSWORD to something more secure.\n"
182+
exit
49183
fi
50184

51185
# Set Time Zone
@@ -58,19 +192,8 @@ dpkg-reconfigure unattended-upgrades
58192
apt install --install-recommends linux-generic-hwe-22.04 -y
59193

60194
sleep 3
61-
# Add User
62-
useradd -m -s /bin/bash -c "Administrative User" ${WEBMIN_USERNAME} ; echo -e "${WEBMIN_PASSWORD}\n${WEBMIN_PASSWORD}" | passwd ${WEBMIN_USERNAME}
63-
64-
# Remove Password Expiration
65-
chage -I -1 -m 0 -M 99999 -E -1 root
66-
chage -I -1 -m 0 -M 99999 -E -1 ${WEBMIN_USERNAME}
67-
68-
# Set Sudo
69-
usermod -aG sudo "${WEBMIN_USERNAME}"
70-
echo "User account ${BOLD}${WEBMIN_USERNAME}${NORMAL} has been created." | boxes -a c -d shell -p a1l2
71195

72196
# Install Check
73-
touch /home/EngineScript/install-log.txt
74197
source /home/EngineScript/install-log.txt
75198

76199
# Repositories
@@ -82,6 +205,15 @@ if [ "${REPOS}" = 1 ];
82205
echo "REPOS=1" >> /home/EngineScript/install-log.txt
83206
fi
84207

208+
# Remove Preinstalled Software
209+
if [ "${REMOVES}" = 1 ];
210+
then
211+
echo "REMOVES script has already run"
212+
else
213+
/usr/local/bin/enginescript/scripts/install/removes/remove-preinstalled.sh
214+
echo "REMOVES=1" >> /home/EngineScript/install-log.txt
215+
fi
216+
85217
# Block Unwanted Packages
86218
if [ "${BLOCK}" = 1 ];
87219
then
@@ -94,15 +226,6 @@ fi
94226
# Update & Upgrade
95227
/usr/local/bin/enginescript/scripts/functions/enginescript-apt-update.sh
96228

97-
# Remove Preinstalled Software
98-
if [ "${REMOVES}" = 1 ];
99-
then
100-
echo "REMOVES script has already run"
101-
else
102-
/usr/local/bin/enginescript/scripts/install/removes/remove-preinstalled.sh
103-
echo "REMOVES=1" >> /home/EngineScript/install-log.txt
104-
fi
105-
106229
# Install Dependencies
107230
if [ "${DEPENDS}" = 1 ];
108231
then
@@ -112,15 +235,6 @@ if [ "${DEPENDS}" = 1 ];
112235
echo "DEPENDS=1" >> /home/EngineScript/install-log.txt
113236
fi
114237

115-
# Enginescript Aliases
116-
if [ "${ALIAS}" = 1 ];
117-
then
118-
echo "ALIAS script has already run"
119-
else
120-
/usr/local/bin/enginescript/scripts/install/alias/enginescript-alias-install.sh
121-
echo "ALIAS=1" >> /home/EngineScript/install-log.txt
122-
fi
123-
124238
# ACME.sh
125239
if [ "${ACME}" = 1 ];
126240
then

enginescript-variables.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-
88

99
# EngineScript Version
10-
VARIABLES_DATE="SEPTEMBER 2 2023"
10+
VARIABLES_DATE="SEPTEMBER 17 2023"
1111

1212
# Software Versions
1313
MARIADB_VER="10.11"
@@ -50,6 +50,8 @@ SERVER_MEMORY_TOTAL_10="$(free -m | awk 'NR==2{printf "%d", $2*0.10 }')"
5050
SERVER_MEMORY_TOTAL_13="$(free -m | awk 'NR==2{printf "%d", $2*0.13 }')"
5151
SERVER_MEMORY_TOTAL_45="$(free -m | awk 'NR==2{printf "%d", $2*0.45 }')"
5252
SERVER_MEMORY_TOTAL_80="$(free -m | awk 'NR==2{printf "%d", $2*0.80 }')"
53+
SERVER_MEMORY_TOTAL_100="$(free -m | awk 'NR==2{printf "%d", $2*1 }')"
54+
5355
UBUNTU_CODENAME="$(lsb_release -sc)"
5456
UBUNTU_VER="$(lsb_release -sr)"
5557

etc/mysql/mariadb.cnf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ tmpdir = /tmp
2828
lc_messages_dir = /usr/share/mysql
2929
lc_messages = en_US
3030
skip-external-locking
31-
31+
collation-server = utf8mb4_unicode_ci
32+
init-connect='SET NAMES utf8mb4'
33+
character-set-server = utf8mb4
3234
default-storage-engine = InnoDB
3335
performance_schema = OFF
3436

@@ -144,6 +146,7 @@ max_allowed_packet = 666M
144146

145147
[mysql]
146148
#no-auto-rehash # faster start of mysql but no tab completion
149+
default-character-set=utf8mb4
147150

148151
[isamchk]
149152
key_buffer = 16M

0 commit comments

Comments
 (0)