From 3d17a98799f70d12924e5416d9dc99c665d4efa7 Mon Sep 17 00:00:00 2001
From: "Fafner [_KeyZee_]" <FafnerKeyZee@users.noreply.github.com>
Date: Tue, 13 Oct 2020 15:05:36 +0200
Subject: [PATCH] Restart lookyloo after update

---
 bin/update.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/bin/update.py b/bin/update.py
index 5101ce9d..ad7a3a5e 100755
--- a/bin/update.py
+++ b/bin/update.py
@@ -86,7 +86,18 @@ def main():
     print('* Update third party dependencies for the website.')
     keep_going(args.yes)
     run_command('tools/3rdparty.py')
-
+    
+    print('* Restarting Lookyloo.')
+    keep_going(args.yes)
+    service = "lookyloo"
+    p =  subprocess.Popen(["systemctl", "is-active",  service], stdout=subprocess.PIPE)
+    (output, err) = p.communicate()
+    if output.decode('utf-8') == "active\n":
+      run_command('sudo service lookyloo restart')
+    else:
+      run_command('poetry run stop')
+      run_command('poetry run start')
+   
 
 if __name__ == '__main__':
     main()