Am 22.05.2012 22:51, schrieb Zbigniew Jędrzejewski-Szmek: > On 05/22/2012 10:46 PM, Joachim Banzhaf wrote: >> It sets and modifies environment variables. I'll have a look and try, > See also Environment= and EnvironmentFile= in systemd.exec(5). > > Zbyszek
I tried now. Not sure if the result is optimal, but it might still help others with a similar problem. 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. I cannot use the script as is in ExecStartPre because this only allows binaries. I even tried /bin/bash script, but as expected the changed environment is not inherited by ExecStart So the only systemd options (I know of now) left are Environment and EnvironmentFile. 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). 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. Finally I tried this, and it worked. But I am not sure about side effects: I changed ExecStart=/usr/sbin/start_apache2 -D SYSTEMD -k start' to ExecStart=/bin/bash -c '. /home/db2inst1/sqllib/db2profile; /usr/sbin/start_apache2 -D SYSTEMD -k start' Thanks for you support!
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel