From 77aae3c456c44a1de9aa200c65648442cfa3bb7c Mon Sep 17 00:00:00 2001 From: Khushboo Vashi Date: Mon, 28 Nov 2022 14:10:07 +0530 Subject: [PATCH] Update 'setup-web.sh' to use systemctl or service automatically based on what is present on the system at runtime Initial Patch By: Serhiy Lakas --- pkg/linux/setup-web.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/linux/setup-web.sh b/pkg/linux/setup-web.sh index 45e616d98..de4f18d23 100755 --- a/pkg/linux/setup-web.sh +++ b/pkg/linux/setup-web.sh @@ -128,7 +128,14 @@ if pgrep ${APACHE} > /dev/null; then case ${RESPONSE} in y|Y ) - if ! systemctl restart ${APACHE}; then + COMMAND="" + if [ -x "$(command -v systemctl)" ]; then + COMMAND="systemctl restart ${APACHE}" + elif [ -x "$(command -v service)" ]; then + COMMAND="service ${APACHE} restart" + fi + + if ! ${COMMAND}; then echo "Error restarting ${APACHE}. Please check the systemd logs" else echo "Apache successfully restarted. You can now start using pgAdmin 4 in web mode at http://127.0.0.1/pgadmin4"