[systemd-devel] Python wrapper to avoid daemon-reload issues
David Strauss
david at davidstrauss.net
Wed Apr 25 01:31:37 PDT 2012
We have an issue with some of our configuration management tools where
daemon-reload and daemon-reexec are necessary for updated service units.
Unfortunately, running either briefly interferes with normal service
manipulation commands like start, stop, and restart. A tool running on the
wrong side of a daemon-reload ends up thinking the service it was working
with is broken.
It's possible to retry a systemctl start, etc. command multiple times if a
daemon-reload is running, but it's kind of dirty.
I figured it's worth sharing this Gist of a Python script I wrote to
smartly wrap systemctl. It takes out a shared lock for normal commands and
an exclusive one for daemon-* commands. This causes normal commands to wait
on completion of daemon-* before attempting service manipulation. I don't
recommend using this to replace the normal systemctl command globally, but
it is a good drop-in when you have multiple tools that might cause each
other problems as I described above.
Here's the code: https://gist.github.com/2488169
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20120425/7f82a99b/attachment.htm>
More information about the systemd-devel
mailing list