[Devel] [PATCH 2/2] scripts: cleanup error output in systemd-autofs-restart.sh

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Fri Jun 23 18:38:35 MSK 2017


Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 scripts/systemd-autofs-restart.sh |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/scripts/systemd-autofs-restart.sh b/scripts/systemd-autofs-restart.sh
index d39e0cd..72d2ef7 100755
--- a/scripts/systemd-autofs-restart.sh
+++ b/scripts/systemd-autofs-restart.sh
@@ -163,13 +163,10 @@ function restart_service {
 
 	# Try to move restored bind-mount aside and exit if Failed
 	# Nothing to do, if we Failed
-	save_mountpoint $mountpoint || return
+	save_mountpoint $mountpoint || return 1
+
+	$JOIN_CT $SYSTEMCTL restart $service || return 1
 
-	$JOIN_CT $SYSTEMCTL restart $service
-	if [ $? -ne 0 ]; then
-		echo "Failed to restart $service service"
-		return
-	fi
 	echo "$service restarted"
 
 	# Try to move saved monutpoint back on top of autofs
@@ -201,7 +198,7 @@ for service in $AUTOFS_SERVICES; do
 	if [ $? -eq 1 ]; then
 		echo "$service skipped ($skip_message)"
 	else
-		restart_service $service
+		restart_service $service || echo "Failed to restart $service service"
 	fi
 done
 



More information about the Devel mailing list