31 lines
584 B
Bash
Executable File
31 lines
584 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [[ -d /var/run/apache2 ]]; then
|
|
mkdir -p /var/run/apache2
|
|
fi
|
|
|
|
while true; do
|
|
echo "Starting apache2"
|
|
. /etc/apache2/envvars
|
|
/usr/sbin/apache2 -D FOREGROUND
|
|
echo "apache2 died: $?"
|
|
sleep 5
|
|
done &
|
|
|
|
while true; do
|
|
echo "Starging nginx"
|
|
/usr/sbin/nginx -g 'daemon off;'
|
|
echo "nginx died: $?"
|
|
sleep 5
|
|
done &
|
|
|
|
#
|
|
# Watch for letsencrypt changes and if they occur, restart nginx and apache2
|
|
#
|
|
while inotifywait -r -e modify /etc/letsencrypt/archive; do
|
|
killall nginx
|
|
rm -f /var/run/nginx.pid
|
|
killall apache2
|
|
rm -f /var/run/apache2/apache2.pid
|
|
done
|