#!/bin/bash exec &> /tmp/tailscale-sleep.log set -x if [ "$1" = "pre" ]; then if tailscale status &>/dev/null; then USER_ID=$(ls /run/user/ | grep -E '^[0-9]+$' | head -n1) ACTIVE_USER=$(id -nu "$USER_ID" 2>/dev/null) if [ -n "$ACTIVE_USER" ]; then systemd-run --machine="${ACTIVE_USER}@.host" --user \ notify-send -i network-vpn-disconnected "Tailscale" "Отключение перед уходом в сон..." fi tailscale down fi fi