Discussion:
Automatically stop a service when a dependent service exits
(too old to reply)
Jakob Schöttl
2018-02-15 09:06:07 UTC
Permalink
Raw Message
Hi,

can I ask a configuration question here?

I have an upload.service, started by an upload.timer. The upload.service
has a Require=ssh-tunnel.service (After= is also set). When the
upload.service is finished how can I make systemd to also stop the
ssh-tunnel.service?

Currently I use systemctl stop ssh-tunnel.service in the upload script.
But since the upload.service has User=<non-root>, I also have to
configure sudo to allow my script to stop the service.

Is there already a systemd solution for this problem?

- Jakob
Jérémy Rosen
2018-02-15 11:02:45 UTC
Permalink
Raw Message
StopWhenUnneeded in man:systemd.unit is probably what you want...
Post by Jakob Schöttl
Hi,
can I ask a configuration question here?
I have an upload.service, started by an upload.timer. The upload.service
has a Require=ssh-tunnel.service (After= is also set). When the
upload.service is finished how can I make systemd to also stop the
ssh-tunnel.service?
Currently I use systemctl stop ssh-tunnel.service in the upload script.
But since the upload.service has User=<non-root>, I also have to
configure sudo to allow my script to stop the service.
Is there already a systemd solution for this problem?
- Jakob
_______________________________________________
systemd-devel mailing list
https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
SMILE <http://www.smile.eu/>

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


*Jérémy ROSEN*
Architecte technique
Responsable de l'expertise Smile-ECS

email ***@smile.fr <mailto:***@smile.fr>
phone +33141402967
url http://www.smile.eu

Twitter <https://twitter.com/GroupeSmile> Facebook
<https://www.facebook.com/smileopensource> LinkedIn
<https://www.linkedin.com/company/smile> Github
<https://github.com/Smile-SA>


Découvrez l’univers Smile, rendez-vous sur smile.eu
<http://smile.eu/?utm_source=signature&utm_medium=email&utm_campaign=signature>

eco Pour la planÚte, n'imprimez ce mail que si c'est nécessaire
Jakob Schöttl
2018-02-15 12:23:25 UTC
Permalink
Raw Message
That's it. Great, Thank you!

Loading...