-
Notifications
You must be signed in to change notification settings - Fork 432
Closed
Description
When we create a symbolic link in /etc/nginx/sites-enabled
Then shell script auto detect any new file is created in /etc/nginx/sites-enabled
Then call nginx -t to check nginx configuration test
If nginx configuration test is passed
Then reload nginx using the following commands
service nginx reload
This following script is just a demo needed proper logging.
#!/bin/bash
dpkg --list | grep inotify-tools &> /dev/null
if [ $? -eq 0 ]
then
echo "Inotify Tools Already Installed"
else
echo "Installing Inotify Tools..."
apt-get -y install inotify-tools
fi
while true
do
inotifywait --exclude .swp -e create -e modify -e delete -e move /etc/nginx/sites-enabled
nginx -t
if [ $? -eq 0 ]
then
echo "Reloading Nginx Configuration"
service nginx reload
fi
done