[systemd-devel] Need help with getting messages into /var/log/messages

Paul Richards paulrichards321 at gmail.com
Sat Aug 4 19:06:38 PDT 2012


Great, thanks for the info!

On Thu, Aug 2, 2012 at 5:03 AM, Mathieu Bridon
<bochecha at fedoraproject.org> wrote:
> On Wed, 2012-08-01 at 23:57 -0400, Paul Richards wrote:
>> 1. My program just runs once on startup and then exits. Do I need to
>> put anything in the service file for that?
>
> Use "Type=oneshot" in the "Service" section.
>
> Otherwise, by default the type is 'simple', and as such systemd will
> consider your service to be in a failure state when it exits.
>
>> 3. My program can fork on startup if its necessary to. Should I run it
>> like that so that it returns immediately? Or just leave it run
>> regularly. Since it uses usb communications it takes about half a
>> second to quit out of the interrupt loop so maybe I should set the
>> fork flag in the service file and have it run that way or is it better
>> to just run regularly from systemd?
>
> If you set it to fork on startup, then you must use "Type=forking",
> otherwise systemd will consider the service to be stopped when the first
> parent exits and will kill all remaining children.
>
> But you said above that your program will exit, so that means it's not
> something that runs in the background as a service, like e.g httpd ?
>
> If so, then "Type=oneshot" is better, systemd will fork to run the
> command anyway, and your service will be considered finished (but not
> failed) when it exits.
>
> (Note: you might be interested in the RemainAfterExit option, depending
> on your use case)
>
>> 4. I am making rpms for this program as well, should I have the
>> service files go into '/etc/systemd/system' or in
>> '/lib/systemd/system'?
>
> They should go in %{_unitdir} ;)
> https://fedoraproject.org/wiki/Packaging:Systemd#Filesystem_locations
>
>
> --
> Mathieu
>
>


More information about the systemd-devel mailing list