@@ -9,11 +9,26 @@ fail() {
99 exit 1
1010}
1111
12+ stop_user_service_quickly () {
13+ local service_name=$1
14+ local service_state
15+ systemctl --user stop --no-block " $service_name " > /dev/null 2>&1 || true
16+ for _ in 1 2 3; do
17+ service_state=$( systemctl --user is-active " $service_name " 2> /dev/null || true)
18+ [[ $service_state == inactive || $service_state == failed ]] && return 0
19+ sleep 1
20+ done
21+ # A manual stop job is already queued, so killing a slow model teardown
22+ # here does not trigger Restart=on-failure.
23+ systemctl --user kill --kill-whom=all --signal=SIGKILL \
24+ " $service_name " > /dev/null 2>&1 || true
25+ }
26+
1227[[ $( uname -s) == Linux && $( uname -m) == aarch64 ]] || \
1328 fail ' run ARDY Blender on the Linux ARM64 DGX Spark'
1429(( ${EUID:- $(id -u)} != 0 )) || fail ' run as the normal desktop user'
1530
16- for command_name in chmod docker hostname install pgrep readlink stat systemctl tee touch tr; do
31+ for command_name in chmod docker hostname install pgrep readlink sleep stat systemctl tee touch tr; do
1732 command -v " $command_name " > /dev/null 2>&1 || fail " missing command: $command_name "
1833done
1934
6378# Keep unrelated image generation out of the unified-memory budget whenever
6479# Blender is open. Blender and the NVIDIA Viser lab are alternative interactive
6580# front ends for the same large ARDY model, so they must not coexist either.
66- systemctl --user stop " ${lumina_services[@]} " > /dev/null 2>&1 || true
67- systemctl --user stop " $viser_service " > /dev/null 2>&1 || true
81+ for lumina_service in " ${lumina_services[@]} " ; do
82+ stop_user_service_quickly " $lumina_service "
83+ done
84+ stop_user_service_quickly " $viser_service "
6885systemctl --user reset-failed " $viser_service " > /dev/null 2>&1 || true
6986if [[ $start_motion == 1 ]]; then
7087 systemctl --user start " $ardy_service " || \
7188 fail ' the open-text ARDY service could not be started'
7289else
73- systemctl --user stop " $ardy_service " > /dev/null 2>&1 || true
90+ stop_user_service_quickly " $ardy_service "
7491fi
7592
7693install -d -m 0700 \
0 commit comments