Hello, It is recommended that you check whether the file has been modified every 5 minutes through the cron shell script, and restart the service automatically if it is modified.:
#!/bin/bash
# Define an array of files to monitor
watch_files=(
"/www/wwwroot/135log.com/.htaccess"
"/www/wwwroot/2.com/.htaccess"
"/www/wwwroot/3.com/.htaccess"
)
# Check if any of the files have been modified within the last 5 minutes
for file in "${watch_files[@]}"
do
if [ "$(find "$file" -mmin -5)" ]
then
echo "File $file has changed, restarting OpenLiteSpeed server..."
/usr/local/lsws/bin/lswsctrl restart
break
fi
done