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

Jean-Marc Pigeon jmp at
Mon Jun 17 20:05:06 UTC 2013


Trying to do an overdue package upgrade for a package we have in  
fedora and I have question
regarding using systemd to do fine tuning configuration on the FIRST  
daemon starting.

With sysVinit it was straightforward enough:
At the first "service start", the script was detecting the  
configuration process never run and
begin a one shot init sequence to (mainly) create database structure  
and prepare an httpd config file. Restarting/starting other needed  
daemon (httpd, dovecot, clamd, etc..).

Trying to do the same within systemd and I have small troubles.

First question:
Sysadmin can choose about data-base to use (postgresql or MySQL,  
editing the config file) and tuning configuration process will check  
proper data-base server
is up and running then create application data-base according a  
configuration variable named "DB_TYPE". I can use "After=" directive
with daemon server (lets say postgresql.service) but sysadmin could  
decide his production server to only use MySQL.
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?).

Second question:
ExecStartPre allow me to start a shell script file (which is used to  
check|do the initial config sequence),
it is my understanding it is not wise (almost forbidden) to start  
daemon within this shell script, is
calling systemctl (restart, start) allowed? (basically; is systemctl  
calling another systemctl technically sound?).

Last question:
When our deamon start, there is a small delay before it set a lock-pid  
(the lock pid is set only
when daemon know its configuration is sound and going in daemon  
background mode). This lock pid is not
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).
I would like to add a delay before systemd check about daemon pid.
According to me [Timer] is not what I am looking for, is there a way  
to add a small delay between  ExecStart
return and PID check?

systemd seems to me more on the Microsoft way of doing thing than Unix  
(so far, I see systemd as trying
to do "all and everything", instead being a small program focused on  
doing only one thing but extremely well).
Hopefully I am wrong, (I must be too much "fine tuned" by using SysV  
since 1984 :-}).

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

More information about the devel mailing list