diff --git a/fedora/tailscale-sleep.sh b/fedora/tailscale-sleep.sh new file mode 100644 index 0000000..2f4744a --- /dev/null +++ b/fedora/tailscale-sleep.sh @@ -0,0 +1,17 @@ +#!/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 \ No newline at end of file