aboutsummaryrefslogtreecommitdiff
path: root/etc/rc.d/syslogd
diff options
context:
space:
mode:
authorGordon Tetlow <gordon@FreeBSD.org>2002-06-13 22:14:37 +0000
committerGordon Tetlow <gordon@FreeBSD.org>2002-06-13 22:14:37 +0000
commit27bc1b287e497f817ea9d08f319e7c7dceb413c4 (patch)
tree3168589e209abd888b033397e3c46dee6131a116 /etc/rc.d/syslogd
parent1cfdefbb9f162da9aa9c045f07394f49aaef1db8 (diff)
downloadsrc-27bc1b287e497f817ea9d08f319e7c7dceb413c4.tar.gz
src-27bc1b287e497f817ea9d08f319e7c7dceb413c4.zip
Notes
Diffstat (limited to 'etc/rc.d/syslogd')
-rwxr-xr-xetc/rc.d/syslogd55
1 files changed, 52 insertions, 3 deletions
diff --git a/etc/rc.d/syslogd b/etc/rc.d/syslogd
index 2c8caeabad8f..07399b8a2fb8 100755
--- a/etc/rc.d/syslogd
+++ b/etc/rc.d/syslogd
@@ -1,21 +1,38 @@
#!/bin/sh
#
-# $NetBSD: syslogd,v 1.6 2000/07/29 21:50:20 veego Exp $
+# $NetBSD: syslogd,v 1.12 2002/03/22 04:34:00 thorpej Exp $
+# $FreeBSD$
#
# PROVIDE: syslogd
# REQUIRE: mountcritremote sysdb wscons
+# BEFORE: SERVERS
+# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="syslogd"
-rcvar=$name
+rcvar=`set_rcvar`
command="/usr/sbin/${name}"
-pidfile="/var/run/${name}.pid"
required_files="/etc/syslog.conf"
start_precmd="syslogd_precmd"
extra_commands="reload"
+_sockfile="/var/run/syslogd.sockets"
+
+case `${CMD_OSTYPE}` in
+FreeBSD)
+ pidfile="/var/run/syslog.pid"
+ evalargs="rc_flags=\"\`set_socketlist\` \$rc_flags\""
+ altlog_proglist="named"
+ ;;
+NetBSD)
+ pidfile="/var/run/${name}.pid"
+ evalargs="rc_flags=\"-P \$_sockfile \$rc_flags\""
+ altlog_proglist="named ntpd"
+ ;;
+esac
+
syslogd_precmd()
{
# Transitional symlink for old binaries
@@ -24,8 +41,40 @@ syslogd_precmd()
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"