* s6-rc: oneshot services do not get their name as arg 1
@ 2024-11-03 21:46 Paul Sopka
2024-11-03 21:57 ` Laurent Bercot
0 siblings, 1 reply; 5+ messages in thread
From: Paul Sopka @ 2024-11-03 21:46 UTC (permalink / raw)
To: supervision
[-- Attachment #1.1.1: Type: text/plain, Size: 218 bytes --]
Hey Everybody
I am wondering why oneshot services do not get their names passed as
argument 1, while longruns do.
Is there a reason for that? If yes, what is it? If not, will this be added?
Regards
Paul
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3195 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: s6-rc: oneshot services do not get their name as arg 1
2024-11-03 21:46 s6-rc: oneshot services do not get their name as arg 1 Paul Sopka
@ 2024-11-03 21:57 ` Laurent Bercot
2024-11-03 22:16 ` Paul Sopka
0 siblings, 1 reply; 5+ messages in thread
From: Laurent Bercot @ 2024-11-03 21:57 UTC (permalink / raw)
To: supervision
>I am wondering why oneshot services do not get their names passed as argument 1, while longruns do.
>Is there a reason for that? If yes, what is it? If not, will this be added?
Longruns being passed their names as argument is a recent addition:
it was useful to implement dynamic instances in s6. It's a pure s6
feature, not an s6-rc one; it just so happens that a longrun's name in
s6-rc translates to the service directory's name in s6.
Oneshots aren't being handled by s6, so they did not benefit from that
change. They're only run at the s6-rc level, and s6-rc does not pass
service names as arguments.
There would be no benefit to doing that, because oneshots do not have
instances, so any up or down script knows exactly what service it is
starting or stopping.
--
Laurent
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: s6-rc: oneshot services do not get their name as arg 1
2024-11-03 21:57 ` Laurent Bercot
@ 2024-11-03 22:16 ` Paul Sopka
2024-11-04 0:17 ` Re[2]: " Laurent Bercot
0 siblings, 1 reply; 5+ messages in thread
From: Paul Sopka @ 2024-11-03 22:16 UTC (permalink / raw)
To: Laurent Bercot, supervision
[-- Attachment #1.1.1: Type: text/plain, Size: 587 bytes --]
Thank you for the quick reply!
> There would be no benefit to doing that, because oneshots do not have
> instances, so any up or down script knows exactly what service it is
> starting or stopping.
I could think of one benefit:
Symlinking the oneshot service directory with other names,
e.g. having a oneshot script for setting up the network
and symlinking it for different interfaces, so that a change
does not have to be made in all the copied scripts
(of course its unlikely to have enough interfaces
to justify this, but it conveys the idea).
Regards
Paul
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3195 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re[2]: s6-rc: oneshot services do not get their name as arg 1
2024-11-03 22:16 ` Paul Sopka
@ 2024-11-04 0:17 ` Laurent Bercot
2024-11-04 7:18 ` Paul Sopka
0 siblings, 1 reply; 5+ messages in thread
From: Laurent Bercot @ 2024-11-04 0:17 UTC (permalink / raw)
To: supervision
>
>Symlinking the oneshot service directory with other names,
>e.g. having a oneshot script for setting up the network
>and symlinking it for different interfaces, so that a change
>does not have to be made in all the copied scripts
>(of course its unlikely to have enough interfaces
>to justify this, but it conveys the idea).
Yeah, I thought about this too, but given the structure of up/down
scripts, it's just not worth it. If your up/down script is bigger
than a one-liner, then unless you're super proficient in execline,
you'll probably want to write your real service script somewhere
and invoke it in up. That's the recommended usage. And as soon as
you're doing that, everything that you want to factorize, you
factorize in your real service script.
For instance, your "eth0" up script could be:
/etc/networking/start-interface eth0
and your "eth1" up script would be:
/etc/networking/start-interface eth1
and all the real work is done in the start-interface script. That way,
you don't have to mess with symlinks in the up scripts, etc.
--
Laurent
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-11-04 7:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-03 21:46 s6-rc: oneshot services do not get their name as arg 1 Paul Sopka
2024-11-03 21:57 ` Laurent Bercot
2024-11-03 22:16 ` Paul Sopka
2024-11-04 0:17 ` Re[2]: " Laurent Bercot
2024-11-04 7:18 ` Paul Sopka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).