| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- #!/usr/bin/env bash
- # stop-dgx-services.sh — Stop non-essential services on a DGX node.
- # Frees unified memory for inference. Machine-specific (DGX), not model-
- # specific — safe to run before any large-model serve.
- #
- # Baked into the sm121 binary at compile time (see src/builtin_scripts.rs);
- # recipes reference it by alias `stop_dgx_services` in a `before_serve` /
- # `after_stop` list. The launcher uploads and runs it via SSH on each node.
- #
- # To restore services afterwards, use `restore_dgx_services` (or reboot).
- set -euo pipefail
- SERVICES_STOP=(
- snapd.service
- fwupd.service
- udisks2.service
- upower.service
- ModemManager.service
- bluetooth.service
- avahi-daemon.service
- cups.service
- cups-browsed.service
- colord.service
- smartmontools.service
- rsyslog.service
- rtkit-daemon.service
- dgx-dashboard-admin.service
- dgx-dashboard.service
- )
- USER_KILL=(
- "pipewire"
- "pipewire-pulse"
- "wireplumber"
- "snapd-desktop-integration"
- )
- echo "=== [$HOSTNAME] Stopping non-essential services ==="
- for svc in "${SERVICES_STOP[@]}"; do
- if systemctl is-active --quiet "$svc" 2>/dev/null; then
- echo " Stopping $svc ..."
- systemctl stop "$svc" 2>/dev/null || true
- systemctl disable "$svc" 2>/dev/null || true
- fi
- done
- for proc in "${USER_KILL[@]}"; do
- pids=$(pgrep -x "$proc" 2>/dev/null || true)
- if [ -n "$pids" ]; then
- echo " Killing $proc (PIDs: $pids) ..."
- kill -TERM $pids 2>/dev/null || true
- fi
- done
- systemctl stop snapd.service snapd.socket 2>/dev/null || true
- echo " Dropping page cache + dentries ..."
- sync
- echo 3 > /proc/sys/vm/drop_caches 2>/dev/null || true
- echo "=== [$HOSTNAME] Done ==="
|