Skip to content

Instantly share code, notes, and snippets.

@sukrit007
Created February 6, 2015 01:00
Show Gist options
  • Save sukrit007/574bfb21fea7bdf1711f to your computer and use it in GitHub Desktop.
Save sukrit007/574bfb21fea7bdf1711f to your computer and use it in GitHub Desktop.
Systemd Reload Hack for Fleet
[Unit]
Description=Systemd Reload Hack for coreos fleet
After=fleet.service
[Service]
Restart=always
RestartSec=20s
ExecStart=/bin/bash -c "while true; do if systemctl -all list-units | grep -e '@.*not-found.*inactive.*dead.*'; then systemctl daemon-reload; fi; systemctl -all list-units | grep '@[0-9].*loaded.*inactive.*dead.*' | awk '{print $1}' | xargs systemctl restart; sleep 120s; done"
@scole-scea
Copy link

Love this. Not exactly what we need here, though, for two reasons (which I'm listing in case others come here looking):

  • It only works with templated service files. Global services, or single-host services managed by fleet don't get any love.
  • It doesn't understand timer unit files (whose associated service files are usually inactive/dead).

I've got fixes in test for both of these issues; I'll post my changes to my own Gist on (likely) Mar 25, 2015.

@scole-scea
Copy link

And that gist is up, if anybody else needs help. https://gist.github.com/scole-scea/177a367c51d0b93d51f6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment