Re: Issue on Ordering of systemd services during boot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You probably have another problem lurking behind...

A.service is of Type=Simple. That means that systemd doesn't know when A.service is ready and will lauch B.socket as soon as A has been launched. B being a socket, it has no delay so will be ready instantly.

You probably want to change Type to something more suiting to your use-case...


Le mar. 10 déc. 2019 à 09:21, Colin Guthrie <gmane@xxxxxxxxxxxxxx> a écrit :
I presume B.socket is some kind of network socket rather than filesystem
path? Either that or A.service provides the filesystem for the socket path?

That being the case, you've got an ordering cycle here as B.socket has
WantedBy=sockets.target which is order before multi-user.target which is
needed by A.service.

Take the WantedBy out of the B.socket (and ensure you remove any
symlinks that were created when it was installed/enabled - better to do
"systemctl disable B.socket" before editing the unit!) and replace it
with multi-user.target too (like A.service) and this should remove the
ordering cycle and give more deterministic behaviour.

HTHs

Col


TARANA, YASHASHVI wrote on 10/12/2019 07:07:
> Hi,
>
>  
>
> I have a systemd service /A.service/ and socket /B.socket /and its
> corresponding service /B./service with the following content:
>
>               
>
>                /A.service/
>
>                               [Unit]
>
>                               Description=A.service
>
>                              
>
>                               [Service]
>
>                               ExecStart=/root/test start
>
>                               RemainAfterExit=true
>
>                               ExecStop=/root/test stop
>
>                               Type=simple
>
>                              
>
>                               [Install]
>
>                               WantedBy=multi-user.target
>
>                              
>
>                /B.socket/
>
>                               [Unit]
>
>                               Description=B.socket
>
>                               *After=A.service*
>
> *BindsTo=A.service*
>
>                              
>
>                               [Socket]
>
>                               ListenDatagram=XXXX
>
>                               Accept=No
>
>                              
>
>                               [Install]
>
>                               WantedBy=sockets.target
>
>  
>
>               
>
>                /B.service/
>
>                               [Unit]
>
>                               Description=B.service
>
>                               Requires=B.socket
>
>                              
>
>                               [Service]
>
>                               Type=simple
>
>                               ExecStart=/root/test1
>
>                               StandardInput=socket
>
>                              
>
>                               [Install]
>
>                               WantedBy=multi-user.target
>
>  
>
>  
>
> I need /B.socket/ to start only after /A.service/ during boot. However,
> even after setting */After=A.service/*//and */BindsTo=A.service/*//in
> /B.socket/, sometimes /B.socket/ is starting before /A.service/.
>
>  
>
> Please let me know if I am missing something.
>
>  
>
>  
>
> Thanks and Regards,
>
> Yashashvi
>
>  
>
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>


--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


--
SMILE 

20 rue des Jardins
92600 Asnières-sur-Seine

Jérémy ROSEN
Architecte technique

email jeremy.rosen@xxxxxxxx 
phone  +33 6 88 25 87 42 
url http://www.smile.eu

Twitter Facebook LinkedIn Github

Découvrez l’univers Smile, rendez-vous sur smile.eu
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux