I was looking through /etc/init.d/ssh to get an idea of how a "proper" sys daemon is run at boot (I'm trying to add svnserve to that list). I saw this log_daemon_msg used as a command, but I have no idea what it is ?

which log_daemon_msg and man log_daemon_msg came up empty.


log_daemon_msg "Starting OpenBSD Secure Shell server" "sshd" || true
if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
    log_end_msg 0 || true
    log_end_msg 1 || true

How does that work? I tried goggling around, but the only things I could were questions about where it records its messages, which is useless since I hardly know how to use it or what it even is - a command, a builtin, or something else ?

  • 1
    Show the complete file: it is likely that this is function defined in a file sourced at the beginning of /etc/init.d/ssh – Matteo Jan 24 '13 at 7:33

That is LSB related functions. Please have a look to /lib/lsb/init-functions and/or /etc/redhat-lsb/lsb_log_message. The path depends on your distro.

  • 2
    Thank you! My googling had revealed that it was somehow related to LSB, and I looked at the Wiki page in fact, but it wasn't particularly useful. Thanks for the path! (It was the former, this is Ubuntu server.) – Dubslow Jan 24 '13 at 7:40
  • Wow, I just missed this little . /lib/lsb/init-functions at the top of the init script I was analyzing... Seems like it's better to write source <...> instead of . <...> when you want the script to be easily analyzed. – Tomasz Gandor Aug 25 '17 at 12:07

I don't have BSD and never used it... but for sure log_daemon_message must be a shell function. Look above that to statements like:

. ./functions

That sources all the functions in the function file. The other thing you can do is to look for the specific function with find:

find /etc -type f -exec grep -li log_daemon_msg {} \;

And see what is in the files. As I said I don't have BSD, but research is fun!

Cheers and good luck

  • It's not BSD, it's Ubuntu 12.04 server; it's just that ssh is a BSD program. @Matteo, I grep'd the file, it's not a locally defined function. I didn't think to check what other files it loads, I'll go do that now. The reason I asked here though is that one result suggested that it's a family of common/widespread functions. – Dubslow Jan 24 '13 at 7:36

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.