Files
scripts/fedora/tailscale-sleep.sh
T
ruslan 485223bab7 Обновить fedora/tailscale-sleep.sh
/etc/systemd/system-sleep/tailscale-sleep.sh
2026-09-18 07:43:45 +00:00

18 lines
600 B
Bash

#!/bin/bash
#Рабочая директория: /etc/systemd/system-sleep/tailscale-sleep.sh
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