From 05fb763200a5edf062b75f641c1ed493d083bb56 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 26 Jun 2020 12:49:28 -0400 Subject: [PATCH] Try to auto-restart httpd on initialize During setup process, restart the service on behalf of user if appropriate service file is found. --- confluent_server/bin/osdeploy | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/confluent_server/bin/osdeploy b/confluent_server/bin/osdeploy index eaf10750..a84a848f 100644 --- a/confluent_server/bin/osdeploy +++ b/confluent_server/bin/osdeploy @@ -106,7 +106,14 @@ def initialize(cmdset): if cmdset.t: didsomething = True certutil.create_certificate() - emprint('New HTTPS certificates generated, restart the web server') + if os.path.exists('/usr/lib/systemd/system/httpd.service'): + subprocess.cheeck_call(['systemctl', 'try-restart', 'httpd']) + print('HTTP server has been restarted if it was running') + elif os.path.exists('/usr/lib/systemd/system/apache2.service'): + subprocess.cheeck_call(['systemctl', 'try-restart', 'apache2']) + print('HTTP server has been restarted if it was running') + else: + emprint('New HTTPS certificates generated, restart the web server manually') if cmdset.s: didsomething = True sshutil.initialize_ca()