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