1#!/bin/sh 2# 3# 4 5# netif is required for lo0 because syslogd tries to open a local socket 6# 7# PROVIDE: syslogd 8# REQUIRE: mountcritremote FILESYSTEMS newsyslog netif 9# BEFORE: SERVERS 10 11. /etc/rc.subr 12 13name="syslogd" 14desc="System log daemon" 15rcvar="syslogd_enable" 16pidfile="/var/run/syslog.pid" 17command="/usr/sbin/${name}" 18required_files="/etc/syslog.conf" 19start_precmd="syslogd_precmd" 20extra_commands="reload" 21 22sockfile="/var/run/syslogd.sockets" 23evalargs="rc_flags=\"\`set_socketlist\` \$rc_flags\"" 24 25: ${syslogd_svcj_options:="net_basic"} 26 27syslogd_precmd() 28{ 29 local _l _ldir 30 31 # Transitional symlink for old binaries 32 # 33 if [ ! -L /dev/log ] && ! check_jail jailed; then 34 ln -sf /var/run/log /dev/log 35 fi 36 rm -f /var/run/log 37 38 # Create default list of syslog sockets to watch 39 # 40 ( umask 022 ; > $sockfile ) 41 42 # If running named(8) or ntpd(8) chrooted, added appropriate 43 # syslog socket to list of sockets to watch. 44 # 45 for _l in $altlog_proglist; do 46 eval _ldir=\$${_l}_chrootdir 47 if checkyesno ${_l}_enable && [ -n "$_ldir" ]; then 48 echo "${_ldir}/var/run/log" >> $sockfile 49 fi 50 done 51 52 # If other sockets have been provided, change run_rc_command()'s 53 # internal copy of $syslogd_flags to force use of specific 54 # syslogd sockets. 55 # 56 if [ -s $sockfile ]; then 57 echo "/var/run/log" >> $sockfile 58 eval $evalargs 59 fi 60 61 return 0 62} 63 64set_socketlist() 65{ 66 local _s _socketargs 67 68 _socketargs= 69 for _s in `cat $sockfile | tr '\n' ' '` ; do 70 _socketargs="-l $_s $_socketargs" 71 done 72 echo $_socketargs 73} 74load_rc_config $name 75run_rc_command "$1" 76