#!/bin/sh # # $NetBSD: syslogd,v 1.12 2002/03/22 04:34:00 thorpej Exp $ # $FreeBSD: src/etc/rc.d/syslogd,v 1.4 2002/10/01 13:29:44 ru Exp $ # # PROVIDE: syslogd # REQUIRE: mountcritremote sysdb # BEFORE: SERVERS . /etc/rc.subr name="syslogd" rcvar=`set_rcvar` command="/usr/sbin/${name}" required_files="/etc/syslog.conf" start_precmd="syslogd_precmd" extra_commands="reload" _sockfile="/var/run/syslogd.sockets" pidfile="/var/run/syslog.pid" evalargs="rc_flags=\"\`set_socketlist\` \$rc_flags\"" 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 ) # Find /etc/rc.d scripts with "chrootdir" rcorder(8) keyword, # and if $${app}_chrootdir is a directory, add appropriate # syslog socket to list of sockets to watch. # for _lr in $(rcorder -k chrootdir /etc/rc.d/*); do ( _l=${_lr##*/} load_rc_config ${_l} eval _ldir=\$${_l}_chrootdir if checkyesno $_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"