Recently I've configured a second dedicated server for hosting WordPress sites for clients. I've got another one that's running for about 4 years.
Server 1: Almalinux 8 + DirectAdmin + OLS
Server 2: Almalinux 10 + DirectAdmin + OLS
Because we need a restart of the webserver after a change in .htaccess files, I'm using on both servers the exact same script, that's based on the well known cron job:
(src: https://codeberg.org/JosKlever/Server-Maintenance/src/branch/main/ols-restart-check.sh)
The script works and the output that I receive by email is the same for both servers, but I notice that on server 2 the htaccess changes are not processed.
I have to do a reload instead of a restart to process the new htaccess files/changes. Even though both restart and reload should have the same function, it apparently doesn't... But when I replace the "restart" by "reload" in the script, I get
What could this be?
Server 1: Almalinux 8 + DirectAdmin + OLS
Server 2: Almalinux 10 + DirectAdmin + OLS
Because we need a restart of the webserver after a change in .htaccess files, I'm using on both servers the exact same script, that's based on the well known cron job:
Code:
#!/bin/sh
#========================
# Description: this script checks if .htaccess files have been changed in order to restart the Open LiteSpeed webserver
# Environment: Almalinux, DirectAdmin (might need adjustments for other setups)
# Save the script in /root/scripts/ols-restart-check.sh and make sure you enter your own email address in the mail command.
# Usage: call this script in /etc/cron.d/openlitespeed_htaccess_scan with the following line:
# */3 * * * root /root/scripts/ols-restart-check.sh
#========================
changed_files=$(find /home/*/domains/*/public_html/ -maxdepth 2 -type f -newer /usr/local/lsws/cgid -name '.htaccess' 2>/dev/null)
if [ -n "$changed_files" ]; then
echo "OpenLiteSpeed restarted due to the following changed .htaccess files:" > /tmp/ols_restart_info.txt
echo "$changed_files" >> /tmp/ols_restart_info.txt
/usr/local/lsws/bin/lswsctrl restart >> /tmp/ols_restart_info.txt 2>&1
mail -s "OpenLiteSpeed Restart Notification" your-email@example.com < /tmp/ols_restart_info.txt
rm /tmp/ols_restart_info.txt
fi
The script works and the output that I receive by email is the same for both servers, but I notice that on server 2 the htaccess changes are not processed.
I have to do a reload instead of a restart to process the new htaccess files/changes. Even though both restart and reload should have the same function, it apparently doesn't... But when I replace the "restart" by "reload" in the script, I get
[ERROR] litespeed is not running.
and this keeps going on until I change it back to "restart".What could this be?