Talk:HOWTO Make an rc script
From Gentoo Linux Wiki
For some reason, my program starts, writes the pidfile, but errors upon a stop command, here's what I have:
#!/sbin/runscript
depend() {
# the daemon needs the internet to function
need net
}
start() {
# display to the user what you're doing
ebegin "Starting InterMapper daemon"
# Start the process as a daemon and record the pid number
start-stop-daemon --start --quiet --background --pidfile /var/run/intermapperd.pid --make-pidfile -- exec /usr/local/bin/intermapperd
# output success or failure
eend $?
}
stop() {
# display a message to the user
ebegin "Stopping InterMapper daemon"
# stop the daemon using the pid recorded from the start() function
start-stop-daemon --stop --quiet --pidfile /var/run/intermapperd.pid --name intermapperd
# output success or failure
eend $?
}
--background --pidfile --make-pidfile --namearguments and add the --exec argument to the stop() function. See the new example on the HOWTO Make an rc script. --Tosk 00:39, 1 Jul 2005 (GMT)
[edit] Dependency order of boot script is affected by CRITICAL_SERVICES
Zaai 18:16, 5 July 2006 (UTC) Tip: The init script order during boot does not always follow the depend order due to the 'CRITICAL_SERVICES' list in /sbin/rc. This can be overridden with a file /etc/runlevels/boot/.critical. See also this thread: http://forums.gentoo.org/viewtopic-p-3427179.html#3427179
