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
This commit is contained in:
Khushboo Vashi 2022-11-28 14:10:07 +05:30 committed by GitHub
parent a737d1167c
commit 77aae3c456
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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"