Skip to content

Instantly share code, notes, and snippets.

@andrebrait
Last active May 22, 2026 10:41
Show Gist options
  • Select an option

  • Save andrebrait/640323bce275223af5fd66040664f313 to your computer and use it in GitHub Desktop.

Select an option

Save andrebrait/640323bce275223af5fd66040664f313 to your computer and use it in GitHub Desktop.
UOS Server Health Check - Restart upon failed startup
# Copy this file to /etc/systemd/system/ and run `systemctl enable uosserver-healthcheck`
[Unit]
Description=Unifi UOS Server Healthcheck
After=uosserver.service
[Service]
Type=oneshot
ExecStartPre=/bin/sleep 30s
ExecStart=/bin/uosserver-healthcheck
[Install]
WantedBy=multi-user.target
#!/bin/bash
# Copy this file to /bin/uosserver-healthcheck
UOS_URL="<insert_here_your-url"
if curl -IksSL -o /dev/null "${UOS_URL}"; then
echo "All good; continuing..."
else
echo "Restarting uosserver..."
uosserver stop
uosserver start
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment