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