From fbdcc4e77f3f4a8cd43dc0ecbc8c0bd9e69e4f01 Mon Sep 17 00:00:00 2001 From: Daniel Hansson Date: Wed, 23 Jan 2019 22:38:38 +0100 Subject: [PATCH] Start if stopped (#776) --- lib.sh | 8 ++++++++ nextcloud_update.sh | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib.sh b/lib.sh index 3c402948..0ab15685 100644 --- a/lib.sh +++ b/lib.sh @@ -208,6 +208,14 @@ do done } +start_if_stopped() { +if ! pgrep "$1" +then + print_text_in_color "$ICyan" "Starting $1..." + check_command service "$1" start +fi +} + # Warn user that HTTP/2 will be disabled if installing app that use Apache2 PHP instead of PHP-FPM # E.g: http2_warn Modsecurity http2_warn() { diff --git a/nextcloud_update.sh b/nextcloud_update.sh index 9c4ed77f..ba1d9dd5 100644 --- a/nextcloud_update.sh +++ b/nextcloud_update.sh @@ -367,7 +367,7 @@ Please check in $BACKUP if the folders exist." fi # Start Apache2 -check_command service apache2 start +start_if_stopped apache2 # Recover apps that exists in the backed up apps folder run_static_script recover_apps