Created
January 16, 2024 22:59
-
-
Save frederikstroem/d72532b46ed1187aa750aedfd51af57f to your computer and use it in GitHub Desktop.
Wait for Tailscale/Headscale backend to start before starting Systemd user service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Waiting for Tailscale Backend | |
[Service] | |
Type=simple | |
EnvironmentFile=%h/waiting_service/.env | |
ExecStartPre=/usr/bin/bash -c 'until [[ "$(tailscale status --json | jq -r '.BackendState')" == "Running" ]]; do sleep 1; done' # Wait for Tailscale/Headscale to start. | |
ExecStart=/usr/bin/python3 %h/waiting_service/main.py | |
Restart=always | |
RestartSec=5 | |
[Install] | |
WantedBy=default.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment