Skip to content

Instantly share code, notes, and snippets.

@rsyring
Created September 26, 2025 19:51
Show Gist options
  • Save rsyring/b479997e8c9cc7dc89b6d744c8b7ba5e to your computer and use it in GitHub Desktop.
Save rsyring/b479997e8c9cc7dc89b6d744c8b7ba5e to your computer and use it in GitHub Desktop.
[Unit]
Description=Github online service
After=network-online.target
# Unlimited retries
StartLimitBurst=0
[Service]
Type=exec
# Restart configuration
Restart=on-failure
RestartSec=5s
# Direct mode on this "upstream" service is critical and results on downstream/dependent services
# waiting on this service to start again. Without it, the downstream services will fail when this
# service enters it's failed status.
RestartMode=direct
# A "pre" call keeps the unit from transitioning into the "active (running)" state briefly
# when ExecStart is executed and the internet is down.
ExecStartPre=curl -sS --connect-timeout 5 --max-time 5 -o /dev/null https://api.github.com/status
# Keep checking while github is up and fail when it's down
ExecStart=/usr/bin/bash -c 'while true; do \
curl -sS \
--show-error \
--connect-timeout 5 \
--max-time 5 \
-o /dev/null \
https://api.github.com/status || exit 1; \
sleep 5; \
done'
[Unit]
Description=Mise and uv updates
# BindsTo/After mean this service will only run when github-online is "active (running)".
BindsTo=github-online.service
After=github-online.service
# Due to RestartMode=direct, this will only fire when all retries have expired.
[email protected]
# Limit to 1st run + 19 retries. With retries every 15 mins, we have ~5h of retries.
StartLimitBurst=20
# Reset limit interval counters after 6 hours so it's starting over for the next calendar run.
StartLimitIntervalSec=6h
[Service]
Type=oneshot
# Restart configuration
Restart=on-failure
RestartSec=5s
RestartMode=direct
# Timeout shouldn't really be needed but could help with a hung network connection.
TimeoutStartSec=5m
ExecStart=echo tooling ran
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment