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