[systemd-devel] making a python daemon both systemd and el5 compatible
Colin Guthrie
gmane at colin.guthr.ie
Mon Jan 27 09:38:43 PST 2014
'Twas brillig, and Greg Swift at 27/01/14 17:20 did gyre and gimble:
> I'm working on a small daemon[1] that doesn't do a whole lot, but we
> need it to work on RHEL5+. Going out of the gate I want to ensure it
> also works with systemd, since i want it to be usable on fedora and el7.
>
> This stackoverflow[2] has a method, but then mentions some compatibility
> problems with the library it recommends that seem like it will not make
> it to friendly back to el5.
>
> In the interm I was going to try leveraging cherrypy's bits (PIDFile and
> Daemonize), but they aren't backwards compatible to EL5, so we have to
> fix that.
>
> I tried to find some place where this was mentioned or recommended but
> my google-fu failed me.
>
> Do you have any recommendations or a existing python daemon that you
> could point me at that has similar needs?
>
> thank you very much
I had to do this recently for something which I run on CentOS5:
http://colin.guthr.ie/git/misc/on-the-pull/commit/?id=9654725a625520bbb57864b1f1cd515948e1106d
It's kinda ugly, but it works.
I added the --pid-file option to the arguments and a --user option
(which needs --pid-file to be passed).
My argument passing code is definitely ugly but I'm pretty lazy and also
fairly crap at knowing all the right knobs to twiddle in python (and
perl) to best leverage their APIs.
Hopefully this is useful.
Patches welcome :p
Col
--
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/
Day Job:
Tribalogic Limited http://www.tribalogic.net/
Open Source:
Mageia Contributor http://www.mageia.org/
PulseAudio Hacker http://www.pulseaudio.org/
Trac Hacker http://trac.edgewall.org/
More information about the systemd-devel
mailing list