[CRIU] [PATCH] scripts: restart all systemd automount services

Eugene Kolomeetz klm at virtuozzo.com
Mon Jun 6 08:42:13 PDT 2016


No need to hardcode list of autofs services,
we can query it dynamically via systemctl.
https://jira.sw.ru/browse/PSBM-46672

Signed-off-by: Eugene Kolomeetz <klm at virtuozzo.com>
---
 scripts/systemd-autofs-restart.sh |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/scripts/systemd-autofs-restart.sh b/scripts/systemd-autofs-restart.sh
index ba32f1f..6ef2261 100755
--- a/scripts/systemd-autofs-restart.sh
+++ b/scripts/systemd-autofs-restart.sh
@@ -39,7 +39,8 @@ JOIN_CT="$NS_ENTER -t $CRTOOLS_INIT_PID -m -u -p"
 # Skip container, if it's not systemd based
 [ "$($JOIN_CT basename -- $($JOIN_CT readlink /proc/1/exe))" == "systemd" ] || exit 0
 
-AUTOFS_SERVICES="proc-sys-fs-binfmt_misc.automount"
+AUTOFS_SERVICES="$($JOIN_CT systemctl --no-legend  -t automount \
+	 --state=active list-units | awk '{ print $1 }')"
 
 bindmount=""
 
@@ -144,13 +145,7 @@ function restart_service {
 }
 
 for service in $AUTOFS_SERVICES; do
-	status=$($JOIN_CT systemctl is-active $service)
-
-	if [ $status == "active" ]; then
-		restart_service $service
-	else
-		echo "$service skipped ($status)"
-	fi
+	restart_service $service
 done
 
 exit 0
-- 
1.7.6



More information about the CRIU mailing list