You are not logged in.
Pages: 1
Hi,
I'm trying a hook before sysinit but it's not working. I created a file called 'custom_hook' in /etc/rc.d/functions.d like this one:
test_hook() {
/bin/echo 'it works' > /opt/testing
}
add_hook sysinit_start test_hook
But it does not execute because file 'testing' is not being created.
Is there anything else to consider?
Thanks in advance!
Matt.
Offline
Offline
@falconindy
Thanks for your clarifications,
1) I didn't know that / is mounted as readonly when sysinit_start runs. How can I write a file before starting daemons? Is there a way to accomplish that?
2) I put the absolute path because I wasn't sure if PATH was loadad in that time.
Offline
@falconindy
Thanks for your clarifications,
1) I didn't know that / is mounted as readonly when sysinit_start runs. How can I write a file before starting daemons? Is there a way to accomplish that?
Look at /etc/rc.sysinit then. root is remounted read only 2-3 lines above where the hook runs. At this point, /run is mounted on tmpfs and writable. This is why it exists.
2) I put the absolute path because I wasn't sure if PATH was loadad in that time.
Builtin means that it isn't executing a file on disk. It's an intrinsic of the shell (most shells have this, even lightweight POSIX shells like dash).
# mv /bin/echo{,~}
$ echo 'your shell knows how to do this'
your shell knows how to do this
Offline
Again, thank you!
I managed to do it with the multi_start hook! :-)
Offline
Pages: 1