Writing Init Scripts: Difference between revisions

From Alpine Linux
(Category:Booting)
(update link)
Line 32: Line 32:


More info here:
More info here:
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4#doc_chap4


[[Category:Booting]]
[[Category:Booting]]

Revision as of 10:27, 1 November 2013

This material is work-in-progress ...

Do not follow instructions here until this notice is removed.
(Last edited by Ncopa on 1 Nov 2013.)

This document explains how to write openrc scripts, aka init.d scripts.

Needs to start with #!/sbin/runscript

Using the start/stop templates and special predefined variables:

description="My Example Daemon"
command="/usr/sbin/mydaemon"
command_args="--args-for-mydaemon"
procname="mydaemon"
pidfile="/var/run/mydaemon.pid"
stopsig="SIGTERM"

Using start-stop-daemon

To be written

start() {
    ebegin "Starting mydaemon"
    start-stop-daemon --start \
        --exec /usr/sbin/mydaemon \
        --pidfile /var/run/mydaemon.pid \
        -- \
        --args-for-mydaemon
    eend $?
}

More info here: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4#doc_chap4