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

Submitted by Stanislav Kinsburskiy on June 23, 2017, 3:38 p.m.

Details

Message ID 20170623153835.964277.85021.stgit@skinsbursky-vz7.qa.sw.ru
State New
Series "systemd-autofs-restart.sh: check systemctl results more"
Headers show

Commit Message

Stanislav Kinsburskiy June 23, 2017, 3:38 p.m.
Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
---
 scripts/systemd-autofs-restart.sh |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

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