On Ubuntu, I copied /etc/init.d/skeleton as a new file and made it "all" executable (just like the others in that directory). In it, I made a "foo" that was just another Bash script in /usr/sbin, but it was special in that it sits in a loop waiting on a named pipe connection from a PHP web page. (More details on that are here, although that's a side topic.)
Because it has to wait in a loop on a named pipe connection, this hung the command up at command line obviously. Not a big deal, because I actually want it to hang and wait on a new connection. But I don't want it happening in the foreground. So, I made start-stop-daemon utilize the --background option.
Okay, it works great for starting and status, but stopping doesn't work -- it leaves the command in memory, as well as the "cat /tmp/pipe" command I have in my /usr/sbin/foo Bash script. They warn that this could happen when using the --background option on the start-stop-daemon command.
So, what's the right way to properly stop /usr/sbin/foo when it's run with start-stop-daemon --background, along with stop any child processes (the cat /tmp/pipe command, for instance) that might be called by /usr/sbin/foo? I mean, I guess I could use killall, but that's kind of deadly. Perhaps you know of a more efficient way?