Discussion:
[systemd-devel] Applications using mulitple fork() in SystemD
Raghavendra. H. R
2016-10-24 17:03:51 UTC
Permalink
Hi All,

I'm a newbie and exploring Systemd init system and I have a doubt regarding
how multiple fork() from an application is handled in SystemD environment.

I have application of process A, which forks process B and B in turn forks
another process C like A -> B -> C.

*My systemd service file will spawn the application and starts process A
and I can see that only process B is forked but not process C.*

Below given is my unit file.

*[Unit]*
*Description=Multiple fork*

*[Service]*
*ExecStart=/etc/A*

*[Install]*
*WantedBy=multi-user.target*


Instead of running in a unit file, if I run my application manually all the
processes will spawned.
For Eg :
======
cd /etc
./A & ---> this will cause all the 3 process to be spawned

Can anyone let me know how to resolve this issue in SystemD ?
Like *"Type=forking", *do we have any other option which helps in achieving
this problem statement.

--
Regards,
Raghavendra. H. R
(Raghu)
Andrei Borzenkov
2016-10-24 17:13:52 UTC
Permalink
Post by Raghavendra. H. R
Hi All,
I'm a newbie and exploring Systemd init system and I have a doubt regarding
how multiple fork() from an application is handled in SystemD environment.
I have application of process A, which forks process B and B in turn forks
another process C like A -> B -> C.
*My systemd service file will spawn the application and starts process A
and I can see that only process B is forked but not process C.*
Below given is my unit file.
*[Unit]*
*Description=Multiple fork*
*[Service]*
*ExecStart=/etc/A*
*[Install]*
*WantedBy=multi-user.target*
Instead of running in a unit file, if I run my application manually all the
processes will spawned.
======
cd /etc
./A & ---> this will cause all the 3 process to be spawned
Can anyone let me know how to resolve this issue in SystemD ?
This is outside of scope of systemd. You need to debug B why it fails to
start C. Most simple answer - it tries to find C in PATH and PATH in
your login session is different from PATH systemd uses.
Post by Raghavendra. H. R
Like *"Type=forking", *do we have any other option which helps in achieving
this problem statement.
--
Regards,
Raghavendra. H. R
(Raghu)
_______________________________________________
systemd-devel mailing list
https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Raghavendra. H. R
2016-10-24 17:35:28 UTC
Permalink
Hi Andrei,

Thanks for the quick reply. *"Most simple answer - it tries to find C in
PATH and PATH in*
*your login session is different from PATH systemd uses.*
*​"*​

​I have all the binaries placed in a single environment file and my unit
file includes that environment file. So ideally it should take all the
binaries from PATH environment variable right.


​



--
Regards,

Raghavendra. H. R
(Raghu)
Post by Raghavendra. H. R
Post by Raghavendra. H. R
Hi All,
I'm a newbie and exploring Systemd init system and I have a doubt
regarding
Post by Raghavendra. H. R
how multiple fork() from an application is handled in SystemD
environment.
Post by Raghavendra. H. R
I have application of process A, which forks process B and B in turn
forks
Post by Raghavendra. H. R
another process C like A -> B -> C.
*My systemd service file will spawn the application and starts process A
and I can see that only process B is forked but not process C.*
Below given is my unit file.
*[Unit]*
*Description=Multiple fork*
*[Service]*
*ExecStart=/etc/A*
*[Install]*
*WantedBy=multi-user.target*
Instead of running in a unit file, if I run my application manually all
the
Post by Raghavendra. H. R
processes will spawned.
======
cd /etc
./A & ---> this will cause all the 3 process to be spawned
Can anyone let me know how to resolve this issue in SystemD ?
This is outside of scope of systemd. You need to debug B why it fails to
start C. Most simple answer - it tries to find C in PATH and PATH in
your login session is different from PATH systemd uses.
Post by Raghavendra. H. R
Like *"Type=forking", *do we have any other option which helps in
achieving
Post by Raghavendra. H. R
this problem statement.
--
Regards,
Raghavendra. H. R
(Raghu)
_______________________________________________
systemd-devel mailing list
https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Loading...