1
Fork 0

Reload nginx on completion

This commit is contained in:
Jake Howard 2023-11-02 22:08:51 +00:00
parent 09113a4777
commit 0b1d838b78
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -8,6 +8,7 @@ from collections import defaultdict
from urllib.request import urlopen
import argparse
import json
import subprocess
TRAEFIK_HOST_RE = re.compile(r"Host\(`([a-z0-9\.-]+)`\)")
@ -81,6 +82,7 @@ def main():
parser.add_argument("--config", "-c", default="./config.toml", type=Path, help="Config file. Default: %(default)s")
parser.add_argument("--output", "-o", type=Path, default="./map.txt", help="Output file. Default: %(default)s")
parser.add_argument("--reload", action="store_true", help="Reload nginx on completion")
args = parser.parse_args()
@ -107,5 +109,15 @@ def main():
print("Found", len(routes), "routes, grouped into", len(grouped_routes), "groups")
if args.reload:
print("Reloading nginx")
subprocess.check_call(
[
"nginx",
"-s",
"reload"
],
)
if __name__ == "__main__":
main()