mirror of
https://github.com/dragonlock2/matthewtran.com.git
synced 2026-06-28 01:58:34 +00:00
major refactor of setup procedure
This commit is contained in:
+11
-5
@@ -1,26 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
# server needs to be up to grab certificates
|
||||
# server needs to be up to get certs
|
||||
nginx
|
||||
while [ ! -f /var/run/nginx.pid ]
|
||||
do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# get certs if needed
|
||||
certbot --nginx \
|
||||
--webroot-path /var/www/matthewtran.com \
|
||||
--non-interactive --agree-tos -m matthewlamtran@berkeley.edu \
|
||||
-d matthewtran.com \
|
||||
-d www.matthewtran.com \
|
||||
-d git.matthewtran.com
|
||||
|
||||
nginx -s reload
|
||||
python3 ip_update.py &
|
||||
python3 cert_update.py &
|
||||
|
||||
# background process to renew certs and check ip changes
|
||||
update() {
|
||||
certbot renew --quiet
|
||||
sleep 86400
|
||||
}
|
||||
update &
|
||||
./ip_update.py &
|
||||
|
||||
# wait for termination
|
||||
cleanup() {
|
||||
echo "stopping..."
|
||||
}
|
||||
trap 'cleanup' TERM
|
||||
|
||||
wait $! # wait SIGTERM, other processes can just be killed
|
||||
|
||||
Reference in New Issue
Block a user