Home | History | Annotate | Line # | Download | only in rc.d
      1   1.1    lukem #!/bin/sh
      2   1.1    lukem #
      3  1.15    lukem # $NetBSD: syslogd,v 1.15 2004/10/11 13:29:52 lukem Exp $
      4   1.1    lukem #
      5   1.1    lukem 
      6   1.1    lukem # PROVIDE: syslogd
      7   1.7    lukem # REQUIRE: mountcritremote sysdb wscons
      8  1.12  thorpej # BEFORE:  SERVERS
      9   1.1    lukem 
     10  1.14  mycroft $_rc_subr_loaded . /etc/rc.subr
     11   1.1    lukem 
     12   1.1    lukem name="syslogd"
     13   1.7    lukem rcvar=$name
     14   1.1    lukem command="/usr/sbin/${name}"
     15   1.1    lukem pidfile="/var/run/${name}.pid"
     16   1.1    lukem required_files="/etc/syslog.conf"
     17   1.1    lukem start_precmd="syslogd_precmd"
     18   1.2    lukem extra_commands="reload"
     19   1.1    lukem 
     20   1.9    lukem _sockfile="/var/run/syslogd.sockets"
     21   1.9    lukem 
     22   1.1    lukem syslogd_precmd()
     23   1.1    lukem {
     24   1.1    lukem 	#	Transitional symlink for old binaries
     25   1.1    lukem 	#
     26   1.1    lukem 	if [ ! -h /dev/log ]; then
     27   1.1    lukem 		ln -sf /var/run/log /dev/log
     28   1.1    lukem 	fi
     29   1.8    lukem 
     30   1.9    lukem 	#	Create default list of syslog sockets to watch
     31   1.9    lukem 	#
     32   1.9    lukem 	( umask 022 ; > $_sockfile )
     33   1.9    lukem 
     34  1.13    lukem 	#	Find /etc/rc.d scripts with "chrootdir" rcorder(8) keyword,
     35  1.13    lukem 	#	and if $${app}_chrootdir is a directory, add appropriate
     36   1.9    lukem 	#	syslog socket to list of sockets to watch.
     37   1.9    lukem 	#
     38  1.13    lukem 	for _lr in $(rcorder -k chrootdir /etc/rc.d/*); do
     39  1.15    lukem 	    (
     40  1.13    lukem 		_l=${_lr##*/}
     41  1.15    lukem 		load_rc_config ${_l}
     42   1.9    lukem 		eval _ldir=\$${_l}_chrootdir
     43   1.9    lukem 		if checkyesno $_l && [ -n "$_ldir" ]; then
     44   1.9    lukem 			echo "${_ldir}/var/run/log" >> $_sockfile
     45   1.9    lukem 		fi
     46  1.15    lukem 	    )
     47   1.9    lukem 	done
     48   1.9    lukem 
     49   1.9    lukem 	#	If other sockets have been provided, change run_rc_command()'s
     50   1.9    lukem 	#	internal copy of $syslogd_flags to force use of specific
     51   1.9    lukem 	#	syslogd sockets.
     52   1.8    lukem 	#
     53   1.9    lukem 	if [ -s $_sockfile ]; then
     54   1.9    lukem 		echo "/var/run/log" >> $_sockfile
     55  1.11    lukem 		rc_flags="-P $_sockfile $rc_flags"
     56   1.8    lukem 	fi
     57   1.8    lukem 
     58   1.1    lukem 	return 0
     59   1.1    lukem }
     60   1.1    lukem 
     61   1.3    lukem load_rc_config $name
     62   1.2    lukem run_rc_command "$1"
     63