[systemd-devel] PgSQL, MySQL systemd services - how to rewrite complex init scripts?

Lennart Poettering lennart at poettering.net
Sat Apr 9 12:48:37 PDT 2011


On Sat, 09.04.11 16:39, Michał Piotrowski (mkkp4x4 at gmail.com) wrote:

> Hi,
> 
> I want to rewrite postgresql and mysqld init scripts for my system
> (later, of course, I want to share them with others) and I wonder if
> there are any recomendations how to rewrite complex scripts.
> 
> Postgresql script has perform_initdb(), initdb() and upgrade()
> functions. IMO these functions should be in separated script. The
> problem is that there are some database format version checks. IMO
> these checks are very important, so maybe it would be a good way to
> move them to separated script and run them with ExecStartPre? But what
> happens when this script exits because database format is old and
> needs an update? How to handle such situation?

If a command specified in ExecStartPre= fails startup of the daemon will
be cancelled, too. (Unless you prefix the command with "-" that is.)

> Mysql script also has some data dir creation code - I think it can
> also be moved to separated script.

tmpfiles.d!

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list