28 lines
552 B
Bash
Executable File
28 lines
552 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 -e modify /etc/letsencrypt/archive; do
|
|
kill -9 "$(cat /var/run/nginx.pid)" "$(cat /var/run/apache2.pid)"
|
|
done
|