2001-06-16 07:16:14 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-06-13 22:14:37 +00:00
|
|
|
# $FreeBSD$
|
2001-06-16 07:16:14 +00:00
|
|
|
#
|
|
|
|
|
2013-05-13 20:28:24 +00:00
|
|
|
# netif is required for lo0 because syslogd tries to open a local socket
|
|
|
|
#
|
2001-06-16 07:16:14 +00:00
|
|
|
# PROVIDE: syslogd
|
2013-05-13 20:28:24 +00:00
|
|
|
# REQUIRE: mountcritremote FILESYSTEMS newsyslog netif
|
2002-06-13 22:14:37 +00:00
|
|
|
# BEFORE: SERVERS
|
2001-06-16 07:16:14 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="syslogd"
|
2012-01-14 02:18:41 +00:00
|
|
|
rcvar="syslogd_enable"
|
2004-01-17 11:19:01 +00:00
|
|
|
pidfile="/var/run/syslog.pid"
|
2001-06-16 07:16:14 +00:00
|
|
|
command="/usr/sbin/${name}"
|
|
|
|
required_files="/etc/syslog.conf"
|
|
|
|
start_precmd="syslogd_precmd"
|
|
|
|
extra_commands="reload"
|
|
|
|
|
2006-12-30 22:53:20 +00:00
|
|
|
sockfile="/var/run/syslogd.sockets"
|
2004-01-17 10:59:43 +00:00
|
|
|
evalargs="rc_flags=\"\`set_socketlist\` \$rc_flags\""
|
2002-06-13 22:14:37 +00:00
|
|
|
|
2001-06-16 07:16:14 +00:00
|
|
|
syslogd_precmd()
|
|
|
|
{
|
2006-12-30 22:53:20 +00:00
|
|
|
local _l _ldir
|
|
|
|
|
2001-06-16 07:16:14 +00:00
|
|
|
# Transitional symlink for old binaries
|
|
|
|
#
|
2014-11-03 00:37:39 +00:00
|
|
|
if [ ! -L /dev/log ] && ! check_jail jailed; then
|
2001-06-16 07:16:14 +00:00
|
|
|
ln -sf /var/run/log /dev/log
|
|
|
|
fi
|
|
|
|
rm -f /var/run/log
|
2002-06-13 22:14:37 +00:00
|
|
|
|
|
|
|
# Create default list of syslog sockets to watch
|
|
|
|
#
|
2006-12-30 22:53:20 +00:00
|
|
|
( umask 022 ; > $sockfile )
|
2002-06-13 22:14:37 +00:00
|
|
|
|
|
|
|
# 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
|
2012-01-14 02:18:41 +00:00
|
|
|
if checkyesno ${_l}_enable && [ -n "$_ldir" ]; then
|
2006-12-30 22:53:20 +00:00
|
|
|
echo "${_ldir}/var/run/log" >> $sockfile
|
2002-06-13 22:14:37 +00:00
|
|
|
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.
|
|
|
|
#
|
2006-12-30 22:53:20 +00:00
|
|
|
if [ -s $sockfile ]; then
|
|
|
|
echo "/var/run/log" >> $sockfile
|
2002-06-13 22:14:37 +00:00
|
|
|
eval $evalargs
|
|
|
|
fi
|
|
|
|
|
2001-06-16 07:16:14 +00:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2002-06-13 22:14:37 +00:00
|
|
|
set_socketlist()
|
|
|
|
{
|
2006-12-30 22:53:20 +00:00
|
|
|
local _s _socketargs
|
|
|
|
|
2002-06-13 22:14:37 +00:00
|
|
|
_socketargs=
|
2006-12-30 22:53:20 +00:00
|
|
|
for _s in `cat $sockfile | tr '\n' ' '` ; do
|
2002-06-13 22:14:37 +00:00
|
|
|
_socketargs="-l $_s $_socketargs"
|
|
|
|
done
|
|
|
|
echo $_socketargs
|
|
|
|
}
|
2001-06-16 07:16:14 +00:00
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|