Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

Example:

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
else
    log_end_msg 1 || true
fi

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 ?

share|improve this question
    
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
add comment

2 Answers

up vote 4 down vote accepted

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.

share|improve this answer
    
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
add comment

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

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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