[systemd-devel] Binary launched in ExecStartPre gets killed...

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Mon Mar 4 06:51:42 PST 2013


On Mon, Mar 04, 2013 at 11:02:36AM +0000, Belal, Awais wrote:
> Hi,
> 
> I have a unit file which does something like this:
> In ExecStartPre -> Start A
> In ExecStart -> Start B
> 
> Now the thing is B depends on A to function correctly and A is a binary itself. The behavior I am seeing is a little obvious but still I thought there might be a way around this. When the unit is started A is launched correctly but then after some time it gets killed with a term signal 15 and this happens before B is started and hence when B is launched it fails. Here's what my unit file looks like...

Hi Awais,
things started from ExecStartPre are supposed to be short lived, and
everything remaining after ExecStartPre is done is killed.  If B
depends on A, then A and B should be separate units.

> [Unit]
> Description=B
> After=xyz.service
> 
> [Service]
> EnvironmentFile=-/tmp/my.env
> ExecStartPre=/bin/sh -c 'echo "ADDRESS=`A --print-path`" > /tmp/my.env'
Security hole BTW.

> ExecStart=/usr/bin/B
> 
> [Install]
> WantedBy=graphical.target
> 
> Any suggestions here would be highly appreciated.
> 
> BR,
> Awais

Zbyszek


More information about the systemd-devel mailing list