Sync glob(3) with FreeBSD:
[dragonfly.git] / etc / rc.d / syslogd
blobb571210fd9989a15fee46bf7bfc15d1dd9219f59
1 #!/bin/sh
3 # $NetBSD: syslogd,v 1.12 2002/03/22 04:34:00 thorpej Exp $
4 # $FreeBSD: src/etc/rc.d/syslogd,v 1.4 2002/10/01 13:29:44 ru Exp $
5 # $DragonFly: src/etc/rc.d/syslogd,v 1.6 2005/11/19 21:47:32 swildner Exp $
8 # PROVIDE: syslogd
9 # REQUIRE: mountcritremote sysdb
10 # BEFORE: SERVERS
12 . /etc/rc.subr
14 name="syslogd"
15 rcvar=`set_rcvar`
16 command="/usr/sbin/${name}"
17 required_files="/etc/syslog.conf"
18 start_precmd="syslogd_precmd"
19 extra_commands="reload"
21 _sockfile="/var/run/syslogd.sockets"
23 pidfile="/var/run/syslog.pid"
24 evalargs="rc_flags=\"\`set_socketlist\` \$rc_flags\""
25 altlog_proglist="named"
27 syslogd_precmd()
29 # Transitional symlink for old binaries
31 if [ ! -L /dev/log ]; then
32 ln -sf /var/run/log /dev/log
34 rm -f /var/run/log
36 # Create default list of syslog sockets to watch
38 ( umask 022 ; > $_sockfile )
40 # If running named(8) chrooted, added appropriate
41 # syslog socket to list of sockets to watch.
43 for _l in $altlog_proglist; do
44 eval _ldir=\$${_l}_chrootdir
45 if checkyesno `set_rcvar $_l` && [ -n "$_ldir" ]; then
46 echo "${_ldir}/var/run/log" >> $_sockfile
48 done
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.
54 if [ -s $_sockfile ]; then
55 echo "/var/run/log" >> $_sockfile
56 eval $evalargs
59 return 0
62 set_socketlist()
64 _socketargs=
65 for _s in `cat $_sockfile | tr '\n' ' '` ; do
66 _socketargs="-l $_s $_socketargs"
67 done
68 echo $_socketargs
70 load_rc_config $name
71 run_rc_command "$1"