I have Debian Lenny box, where I plan to extensively use start-stop-daemon. The trouble is, the standard Debian start-stop-daemon doesn't support output redirection: --stdout and --stderr keys, which I want to use to log daemons activity.

Should I just update start-stop-daemon from sources? I tried apt-get update process, the version still lacks features. Will it break something in Debian? Or should I compile new start-stop-daemon to some new directory and use it for my daemons, leaving standard Debian package in place?

I don't want to write .sh wrapper scripts to each daemon, as there will be many of them.


Normally I'd suggest backporting the version you want to lenny from unstable.; just grab all the sources from the unstable tree for that package... but, oof, it's in the dpkg package, which is probably more than you want to bite off.

So yes, compile it yourself and put it in /usr/local/bin/ and you should be good to go.


The man-page for start-stop-deamon does provide a clue on how to redirect stdout/stderr, albeit in a cryptic fashion:

Any arguments given after -- on the command line are passed unmodified to the program being started.

Thus, the following syntax would allow you to use start-stop-daemon with redirection of stdout/stderr

    OPTIONS=" 1>/dev/null 2>${logfile}"
    start-stop-daemon --start --startas /usr/bin/foo  -- $OPTIONS

Did you think to write a .sh wrapper for start-stop-deamon instead?

You could rename original start-stop-deamon executable and create your .sh wrapper with "start-stop-deamon" name.

  • Hmmm... I don't know what to write there. Is there a way to redirect a daemon's output in start-stop-daemon without using --stdout/--stderr (maybe with &1>, &2>) ? – Kuroki Kaze Jul 14 '10 at 11:16
  • Yes...I think something like &1> &2>. – lg. Jul 14 '10 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.