From 8a4eb3f2a33e6a0be20efe54142a4937b2d48482 Mon Sep 17 00:00:00 2001 From: bunkerity Date: Wed, 18 Aug 2021 12:07:11 +0200 Subject: [PATCH] remove .site files (gen), uninstall remove folder at the end (linux) and run jobs when reloading local instances (UI) --- gen/main.py | 2 +- helpers/uninstall.sh | 12 ++++++------ ui/src/Instances.py | 8 ++++++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/gen/main.py b/gen/main.py index eca33ce..e946dd8 100755 --- a/gen/main.py +++ b/gen/main.py @@ -53,7 +53,7 @@ if __name__ == "__main__" : # Remove old files files = glob.glob(args.output + "/*") for file in files : - if file.endswith(".conf") and os.path.isfile(file) and not os.path.islink(file) : + if (file.endswith(".conf") or file.endswith(".env")) and os.path.isfile(file) and not os.path.islink(file) : os.remove(file) elif os.path.isdir(file) and not os.path.islink(file) : shutil.rmtree(file, ignore_errors=False) diff --git a/helpers/uninstall.sh b/helpers/uninstall.sh index 9aaffce..121e406 100755 --- a/helpers/uninstall.sh +++ b/helpers/uninstall.sh @@ -47,12 +47,6 @@ fi do_and_check_cmd mv /lib/systemd/system/nginx.service.bak /lib/systemd/system/nginx.service do_and_check_cmd systemctl daemon-reload -# Remove /opt/bunkerized-nginx -if [ -e "/opt/bunkerized-nginx" ] ; then - echo "[*] Remove /opt/bunkerized-nginx" - do_and_check_cmd rm -rf /opt/bunkerized-nginx -fi - # Remove UI service systemctl status bunkerized-nginx-ui > /dev/null 2>&1 if [ $? -eq 0 ] ; then @@ -78,5 +72,11 @@ if [ -e "$CRON_PATH" ] ; then do_and_check_cmd rm -f "$CRON_PATH" fi +# Remove /opt/bunkerized-nginx +if [ -e "/opt/bunkerized-nginx" ] ; then + echo "[*] Remove /opt/bunkerized-nginx" + do_and_check_cmd rm -rf /opt/bunkerized-nginx +fi + # We're done echo "[*] bunkerized-nginx successfully uninstalled" diff --git a/ui/src/Instances.py b/ui/src/Instances.py index b48a2bb..5afbff0 100644 --- a/ui/src/Instances.py +++ b/ui/src/Instances.py @@ -103,8 +103,12 @@ class Instances : instance = self.__instance_from_id(id) result = True if instance["type"] == "local" : - proc = subprocess.run(["/usr/sbin/nginx", "-s", "reload"], capture_output=True) - result = proc.returncode == 0 + proc = subprocess.run(["/opt/bunkerized-nginx/entrypoint/jobs.sh"], capture_output=True) + if proc.returncode != 0 : + result = False + else : + proc = subprocess.run(["/usr/sbin/nginx", "-s", "reload"], capture_output=True) + result = proc.returncode == 0 elif instance["type"] == "container" or instance["type"] == "service" : result = self.__api_request(instance, "/reload") if result :