#!/bin/bash
# Look for a .htaccess file that has been modified less than 10 minutes ago
# (feel free to adjust that number to your neeeds) and if it finds something
# it then proceeds to restart OpenLiteSpeed webserver to make it load the
# contents of that .htaccess file anew
if ! find /home/*/*/public_html/ -newermt '10 minutes ago' \
-type f -name '.htaccess' -exec false {} +; \
then \
echo "Restarting Litespeed server..." ; systemctl restart lsws ; \
else \
echo "No recent changes to .htaccess file(s) detected. No restart necessary." ; \
fi
# Script created by Ivan Arnaudov
# https://m.me/ivan.webstage
Comments