Mailing List Archive

FreeBSD Startup Script
I've been researching how to do this without success. I tried modifying the syslogd startup script, but it doesn't seem to work. Maybe someone else could take a crack at it?



#!/bin/sh
#
# $NetBSD: syslogd,v 1.12 2002/03/22 04:34:00 thorpej Exp $
# $FreeBSD: src/etc/rc.d/syslogd,v 1.9.2.1 2004/10/10 09:50:54 mtm Exp $
#

# PROVIDE: rsyslogd
# REQUIRE: mountcritremote cleanvar
# BEFORE: SERVERS

. /etc/rc.subr

name="rsyslogd"
rcvar=`set_rcvar`
#pidfile="/var/run/syslog.pid"
command="/usr/sbin/${name}"
required_files="/etc/rsyslog.conf"
#start_precmd="syslogd_precmd"
#extra_commands="reload"

#_sockfile="/var/run/syslogd.sockets"
#evalargs="rc_flags=\"\`set_socketlist\` \$rc_flags\""
#altlog_proglist="named"

#syslogd_precmd()
#{
# Transitional symlink for old binaries
#
# if [ ! -L /dev/log ]; then
# ln -sf /var/run/log /dev/log
# fi
# rm -f /var/run/log

# Create default list of syslog sockets to watch
#
# ( umask 022 ; > $_sockfile )

# If running named(8) or ntpd(8) chrooted, added appropriate
# syslog socket to list of sockets to watch.
#
# for _l in $altlog_proglist; do
# eval _ldir=\$${_l}_chrootdir
# if checkyesno `set_rcvar $_l` && [ -n "$_ldir" ]; then
# echo "${_ldir}/var/run/log" >> $_sockfile
# fi
# done

# If other sockets have been provided, change run_rc_command()'s
# internal copy of $syslogd_flags to force use of specific
# syslogd sockets.
#
# if [ -s $_sockfile ]; then
# echo "/var/run/log" >> $_sockfile
# eval $evalargs
# fi

# return 0
#}

#set_socketlist()
#{
# _socketargs=
# for _s in `cat $_sockfile | tr '\n' ' '` ; do
# _socketargs="-l $_s $_socketargs"
# done
# echo $_socketargs
#}
load_rc_config $name
run_rc_command "$1"
FreeBSD Startup Script [ In reply to ]
Using the modified syslogd script, rsyslogd did not start. There were no error messages that I know of. Not that I would know where to find them.

I did get a script working. I tried to add the line # BEFORE: SERVERS, but this also caused rsyslogd to not start.

The below script works for me. Perhaps you'd like to suggest appropriate modifications. Perhaps you'd like to add it to the rsyslog distribution.

added rsyslogd_enable="yes" to /etc/rc.conf

added /etc/rc.d/rsyslogd:

#!/bin/sh
# PROVIDE: rsyslogd
# REQUIRE: NETWORKING

. /etc/rc.subr

name="rsyslogd"
rcvar=`set_rcvar`
command="/usr/sbin/rsyslogd"
pidfile="/var/run/rsyslogd.pid"
required_files="/etc/rsyslog.conf"

load_rc_config $name
run_rc_command "$1"


Appropriate execute permissions must be applied to /etc/rc.d/rsyslogd. Other files in /etc/rc.d have permissions of 555. 555 or 755 would be appropriate.

Also, rsyslog-093 seems to be logging it's version as 092.

I'd like to suggest that the semi-colon be added to the end of line 178 in sample.conf. This is such a simple fix that can eliminate potential problems when a user attempts to log to a MySQL database.
FreeBSD Startup Script [ In reply to ]
Version number isn't important enough to go back and rebuild. I have no idea about the libmysql client startup issue. I suppose you saw something on the screen to that effect. I implemented the script on a headless machine, so I couldn't see any startup messages. Don't forget about the semi-colon...line 178...sample.conf. It's ticking me off. 8)
FreeBSD Startup Script [ In reply to ]
I was able to reproduce the libmysql errors during startup. Of course, I have no earthly idea how to go about troubleshooting or fixing them. I did do some testing on the startup script.

The FreeBSD boot sequence goes in the following order: NETWORKING, SERVERS, DAEMON, LOGIN.

I'd like to see rsyslogd start up as soon as possible in order to log a maximum amount of information. If logging to a remote database, rsyslogd must obviously be started after NETWORKING. This is the scenario I use for testing, since this is the scenario I use in production. I tried configuring rsyslogd to start before each of the following checkpoints (SERVERS, DAEMON, LOGIN) without success. Libmysql error with every configuration. The only working configuration was to omit the # BEFORE statement in the rsyslogd startup script.

The following information from the FreeBSD rc(8) man page may or may not having some bearing. The FreeBSD startup script currently uses the bar configuration. I honestly have no idea what advantages the foo.sh configuration could offer.

foo.sh Scripts that are to be sourced into the current shell
rather than a subshell have a .sh suffix. Extreme
care must be taken in using this, as the startup
sequence will terminate if the script does.

bar Scripts that are sourced in a subshell.