Need some advices moving a fedora package from sysVinit to systemd t

Jean-Marc Pigeon jmp at safe.ca
Mon Jun 17 23:50:05 UTC 2013


Hello Lennart,

Many thank for you advices, but...

Quoting Lennart Poettering <mzerqung at 0pointer.de>:


>> So the service "After=" directive should be conditional to an env variable.
>> I have seen no provision within systemd to resolve such case... Could
>> somebody propose
>> a nice way to resolve such needs within systemd service file? (if this
>> is achievable?).
>
> You can add After= for both databases. After= orders units only if they
> exist, and if they don't htey have no effect. Hence simply lists all
> database services you support and you should be fine.

I just understood I need "Requires=" instead of "After=" as the application
"require" the data-base daemon to be up and running in order to be  
operational.
Then (to do some testing), I required "spamassassin.service  
dovecot.service bigre.service"
sure enough "bigre.service" is unknown (as expected) and systemctl complain
"Failed to issue method call: Unit bigre.service failed to load: No  
such file or directory"
(as it should).
Such I can't require a service the sysadmin don't want to use (lets  
say he want just
use Posgresql but not want to start Mysqld at all and didn't bother to  
install it).
So it will be nice to have a way to do "conditional require", if not,  
we are asking the
sysadmin to "mess up" with the service definition file (which is not good)...

>>
>> Second question:
>
>> calling systemctl (restart, start) allowed? (basically; is systemctl
>> calling another systemctl technically sound?).
>
> All processes started by ExecStartPre= will be killed before ExecStart=
> is run. You cannot fork long-running processes from that.
>
> It's usually a bad idea to run systemctl from ExecStartPre= since that
> hides dependencies. With Wants= and After= you should have all you need
> to make these depdendencies explicit

Agreed, dependency are nicely resolved by "Requires=" directive, but while
doing the first start config I need (at least) to restart httpd.service
once a new WEB interface is automatically defined by application first  
start config.
The only way I see is within the ExecStartPre script to issue
systemctl restart httpd
once the new application httpd configuration is done.
if that is not a good way, how can I handle such situation within
the service definition file?.


>
> If you have various bits you need to run in order to get your service
> up, it's a good idea to simply split up the logic into two unit files,
> and pull in one from the other and add ordering between them. This makes
> it unnecessary to invoke systemctl from ExecStartPre= or any other such
> command.

Sorry I do not understand how this resolve the "restart needed" situation.
What am I missing?

>
>> Last question:
[..]
>> yet available  within PIDFile when the process started by ExecStart exit.
>> So systemd complain about the fact the daemon never started (which is
>> not true, daemon is up and running).
>
> Use Type=forking. That will cause systemd wait for the initial process
> to exit before checking for the PID file.
>
Was already with Type=forking, the initial process start, initiate the
daemon itself, starting in background (which set-up a lock file with  
its own process PID)
once some checking is done.
Timing are such, systemctl check for pid befor lock file is in place.
A timer capability of some kind, would be nice?.


> Lennart
>
> --
> Lennart Poettering - Red Hat, Inc.
> --
> devel mailing list
> devel at lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/devel

-- 
A bientôt
===========================================================
Jean-Marc Pigeon                        E-Mail: jmp at safe.ca
SAFE Inc.                             Phone: (514) 493-4280
   Clement, 'a kiss solution' to get rid of SPAM (at last)
      Clement' Home base <"http://www.clement.safe.ca">
===========================================================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5919 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.fedoraproject.org/pipermail/devel/attachments/20130617/a0114d5b/attachment-0001.p7s>


More information about the devel mailing list