Quantcast
Channel: Active questions tagged 22.04 - Ask Ubuntu
Viewing all articles
Browse latest Browse all 4439

create a dependencies for services with systemd

$
0
0

im trying to create a ServiceB that start after ServiceA starts.

This is what i tried to do :

ServiceA file:

[Unit] Description=ServiceA After=network.target[Service] ExecStartPre=running some shell script.... ExecStart=running some shell script....ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failureRestartPreventExitStatus=255 TimeoutStopSec=10[Install] WantedBy=multi-user.target

first ServiceB file try:

[Unit] Description=ServiceB After=ServiceA.serviceRequires=ServiceA.service[Service] ExecStart=running some shell script.... [Install] WantedBy=multi-user.target

second ServiceB file try:

[Unit] Description=ServiceB After=ServiceA.serviceRequires=ServiceA.service[Service] ExecStart=running some shell script.... [Install]WantedBy=ServiceA.service

the first try works, but only at startup, but when i stop the services withsystemctl stop ServiceAsystemctl stop ServiceA

and then try to start the again ServiceAsystemctl start ServiceA

i thought that ServiceB should start too (it still enabled)

what can be the problem ?

** i dont want to use Wants= in the ServiceA file, i want that ServiceB will manage it .


Viewing all articles
Browse latest Browse all 4439

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>