View previous topic :: View next topic |
Author |
Message |
maxxim n00b
Joined: 03 Feb 2015 Posts: 27
|
Posted: Thu Sep 02, 2021 10:38 am Post subject: How to modify init script dependencies |
|
|
Hi fellow Gentoonians,
I need to add the dependency 'need net' to both '/etc/init.d/ntp-client' and '/etc/init.d/samba'. Thus far, I have modified the init scripts directly
Code: | depend() {
...
need net
}
|
but I wonder if that's really the right way to do this. Can this also somehow be done via the configuration files, i.e. by modifying '/etc/conf.d/ntp-client' and '/etc/conf.d/samba'? |
|
Back to top |
|
|
eccerr0r Watchman
Joined: 01 Jul 2004 Posts: 9691 Location: almost Mile High in the USA
|
Posted: Thu Sep 02, 2021 2:08 pm Post subject: |
|
|
I believe this is the right way - adding the dependency to the init scripts - though I thought most of these packages that don't have these dependencies already written in their init scripts, well, autodetect interfaces dynamically, as in they will notice new interfaces added and open sockets on them?
Is this not happening? Or not fast enough? Yeah it's annoying that it may take a while to be ready with a correct date and serve samba requests but they should work. The dependencies were omitted mostly to speed up boot times... _________________ Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 21724
|
Posted: Thu Sep 02, 2021 4:18 pm Post subject: |
|
|
According to man openrc-run, yes, this can be done through conf.d. Code: | With the exception of /etc/rc.conf, the configuration files can also in‐
fluence the dependencies of the service through variables. Simply prefix
the name of the dependency with rc_. | For example: Code: | # grep rc_need -r /etc/conf.d/
/etc/conf.d/sshd:rc_need="net.eth0" |
|
|
Back to top |
|
|
maxxim n00b
Joined: 03 Feb 2015 Posts: 27
|
Posted: Thu Sep 02, 2021 4:59 pm Post subject: |
|
|
eccerr0r wrote: | I believe this is the right way - adding the dependency to the init scripts - though I thought most of these packages that don't have these dependencies already written in their init scripts, well, autodetect interfaces dynamically, as in they will notice new interfaces added and open sockets on them?
Is this not happening? Or not fast enough? Yeah it's annoying that it may take a while to be ready with a correct date and serve samba requests but they should work. The dependencies were omitted mostly to speed up boot times... |
I'm using ifplugd, which means ethernet will start in the background during boot and not synchronously. I added 'need net' to ntp-client so it would also be started in the background once ethernet is ready (without this, it would stall booting and/or fail, iirc).
As for samba, I was experiencing issues regarding suspend/resume. Samba shares would be unreachable after resuming. Even restarting samba right after resume using an elogind hook script wouldn't work. Adding 'need net' + restarting ethernet after resume fixed this (also see https://forums.gentoo.org/viewtopic-p-8653804.html#8653804).
Last edited by maxxim on Thu Sep 02, 2021 5:03 pm; edited 3 times in total |
|
Back to top |
|
|
maxxim n00b
Joined: 03 Feb 2015 Posts: 27
|
Posted: Thu Sep 02, 2021 5:01 pm Post subject: |
|
|
Hu wrote: | According to man openrc-run, yes, this can be done through conf.d. Code: | With the exception of /etc/rc.conf, the configuration files can also in‐
fluence the dependencies of the service through variables. Simply prefix
the name of the dependency with rc_. | For example: Code: | # grep rc_need -r /etc/conf.d/
/etc/conf.d/sshd:rc_need="net.eth0" |
|
YES, that would be it. I knew I read something like this a while ago, but I couldn't remember the details. This is better than modifying the init scripts in my opinion as it makes upgrades easier.
I'll give it try. Thanks! |
|
Back to top |
|
|
|