Skip to content

systemd Service ​

The systemd user unit is generated by the CLI itself from a template shipped inside the package, so a Git checkout and a pip / pipx installation produce the same unit file.

Service Subcommands ​

sh
windowping service install      # write ~/.config/systemd/user/windowping.service, enable + start
windowping service status       # systemctl status + last log lines
windowping service logs -f      # journalctl -f
windowping service restart      # after editing the config
windowping service uninstall    # disable + remove the unit
windowping service start|stop|enable|disable

Useful flags:

  • windowping service install --no-start enables the unit without starting it.
  • windowping service install --force rewrites a unit whose content drifted.
  • Run loginctl enable-linger "$USER" so the user service stays alive when you are not logged in.

Watchdog & Reliability ​

The unit runs with Type=notify and WatchdogSec=300: the watcher sends READY=1 when the loop starts, WATCHDOG=1 after every tick, and STOPPING=1 on clean exit, so systemd knows the difference between "running" and "hung" and restarts the latter (Restart=on-failure, RestartSec=5s).

This is implemented in a ~40-line sdnotify.py over a Unix datagram socket — no external dependencies.

Adjusting WatchdogSec with slow tick_interval

If you raise tick_interval above ~4 minutes, raise WatchdogSec in the unit file with it, or systemd will restart the watcher for being slow rather than stalled.

Failure Handling & Escalation ​

Failure handling is deliberately boring: a failed ping is reported once, and after escalate_after failures in a row (default 3) the bot says so explicitly and points at windowping doctor. A successful ping resets the streak.

Connection-level drops (reset, TLS handshake, SSL EOF, DNS) are retried inside the same tick (ping_retries = 2, read_retries = 1 with doubling retry_delay), while provider errors (401, 500, bad payload) are not retried in-tick and wait failed_ping_cooldown (default 5m).

Cron Alternative ​

Prefer cron instead of a long-running daemon? Run one scheduler pass every minute:

txt
* * * * * /usr/bin/python3 -m windowping tick

Released under the MIT License.