An open API service indexing awesome lists of open source software.

https://github.com/josh/wait4tailscale

Monitor Tailscale connection status
https://github.com/josh/wait4tailscale

systemd tailscale

Last synced: about 1 month ago
JSON representation

Monitor Tailscale connection status

Awesome Lists containing this project

README

          

# wait4tailscale

> **Deprecated:** This project's functionality has been upstreamed into Tailscale itself. Since Tailscale v1.82, you can use the built-in [`tailscale wait`](https://github.com/tailscale/tailscale/pull/18574) command and [`tailscale-online.target`](https://github.com/tailscale/tailscale/pull/18577) systemd target instead.
>
> ```
> $ tailscale wait && /path/to/your/service
> ```
>
> For systemd services:
>
> ```ini
> [Unit]
> After=tailscale-online.target
> Requires=tailscale-online.target
> ```
>
> The `tailscale wait` command also supports a `--timeout` flag and there is a new `tailscale ip --assert=` option for verifying a specific IP assignment.

---

Basically a rich man's version of this poor man's bash script:

```bash
while ! tailscale status --json | jq --exit-status '.Self.Online' >/dev/null
sleep 1
done
```

## Usage

Block until tailscale reaches an online or offline state. Returns immediately if its already in its desired state.

```
$ wait4tailscale --online
$ wait4tailscale --offline
```

Or watch a log of all changes

```
$ wait4tailscale --watch
online
offline
online
```

Will automatically detect the default socket location, but otherwise a socket can be explicitly given.

```
$ wait4tailscale --socket /var/run/tailscale/tailscaled.sock
```

### systemd Integration

The package includes systemd units that provide a `tailscale-online.target` similar to `network-online.target`. Other services can depend on this target to wait for Tailscale connectivity:

```ini
[Unit]
After=tailscale-online.target
Wants=tailscale-online.target
```

### Nix

Packaged under [josh/nurpkgs](https://github.com/josh/nurpkgs) flake. Use the systemd units in your NixOS config with something like this:

```nix
systemd.packages = [ pkgs.nur.repos.josh.wait4tailscale ];
```