<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Am 22.05.2012 22:51, schrieb Zbigniew Jędrzejewski-Szmek:<br>
<span style="white-space: pre;">> On 05/22/2012 10:46 PM, Joachim
Banzhaf wrote:<br>
>> It sets and modifies environment variables. I'll have a
look and try,<br>
> See also Environment= and EnvironmentFile= in
systemd.exec(5).<br>
><br>
> Zbyszek</span><br>
<br>
I tried now. Not sure if the result is optimal, but it might still
help others with a similar problem.<br>
<br>
The DB2 provided profile script (for now) only sets and changes
environment variables (PATH, LD_LIBRARY_PATH, CLASSPATH,
DB2INSTANCE), with some if/else logic based on what product options
are installed or not.<br>
<br>
I cannot use the script as is in ExecStartPre because this only
allows binaries.<br>
I even tried /bin/bash script, but as expected the changed
environment is not inherited by ExecStart<br>
<br>
So the only systemd options (I know of now) left are Environment and
EnvironmentFile.<br>
I went with EnvironmentFile, because that is what I used before. I
just added the variables by hand instead of by sourcing the
db2profile script. This worked (I had to export the variables to
make it backward compatible with SysV init though).<br>
<br>
If I'd use this approach with systemd and DB2 I'd have to manually
analyze changes in the db2profile and try to mimic that with every
fixpack or special build delivered by IBM. Too error prone, not
acceptable.<br>
<br>
Finally I tried this, and it worked. But I am not sure about side
effects:<br>
<br>
I changed<br>
ExecStart=/usr/sbin/start_apache2 -D SYSTEMD -k start'<br>
to<br>
ExecStart=/bin/bash -c '. /home/db2inst1/sqllib/db2profile;
/usr/sbin/start_apache2 -D SYSTEMD -k start'<br>
<br>
<br>
Thanks for you support!<br>
</body>
</html>