| 1 | #!/bin/sh |
| 2 | # Sample startup script for rsyslogd on FreeBSD. |
| 3 | # It worked on my machine, but this does not necessarily |
| 4 | # mean it works on all machines - it's not thouroughly |
| 5 | # tested. Please note that it may also work on other |
| 6 | # BSD variants, too. |
| 7 | # |
| 8 | # As of this writing, there was an issue with the mysql client |
| 9 | # library on startup. If compiled with MySQL support, rsyslogd |
| 10 | # would not necessarily start correctly but could eventually |
| 11 | # die with a "mysql client libary not found" (or similar) |
| 12 | # message. I do not know its cause neither the cure. If you |
| 13 | # have one, let me know. |
| 14 | # |
| 15 | # ATTENTION: you need also to change the /etc/rc.config file |
| 16 | # and disable stock syslogd and then enable rsyslogd! |
| 17 | # |
| 18 | # rgerhards 2005-08-09 <[email protected]> |
| 19 | # |
| 20 | |
| 21 | # PROVIDE: rsyslogd |
| 22 | # REQUIRE: mountcritremote cleanvar |
| 23 | # BEFORE: SERVERS |
| 24 | |
| 25 | . /etc/rc.subr |
| 26 | |
| 27 | name="rsyslogd" |
| 28 | rcvar=`set_rcvar` |
| 29 | pidfile="/var/run/rsyslogd.pid" |
| 30 | command="/usr/sbin/${name}" |
| 31 | required_files="/etc/rsyslog.conf" |
| 32 | start_precmd="rsyslogd_precmd" |
| 33 | extra_commands="reload" |
| 34 | |
| 35 | _sockfile="/var/run/rsyslogd.sockets" |
| 36 | evalargs="rc_flags=\"\`set_socketlist\` \$rc_flags\"" |
| 37 | altlog_proglist="named" |
| 38 | |
| 39 | rsyslogd_precmd() |
| 40 | { |
| 41 | # Transitional symlink for old binaries |
| 42 | # |
| 43 | if [ ! -L /dev/log ]; then |
| 44 | ln -sf /var/run/log /dev/log |
| 45 | fi |
| 46 | rm -f /var/run/log |
| 47 | |
| 48 | # Create default list of syslog sockets to watch |
| 49 | # |
| 50 | ( umask 022 ; > $_sockfile ) |
| 51 | |
| 52 | # If running named(8) or ntpd(8) chrooted, added appropriate |
| 53 | # syslog socket to list of sockets to watch. |
| 54 | # |
| 55 | for _l in $altlog_proglist; do |
| 56 | eval _ldir=\$${_l}_chrootdir |
| 57 | if checkyesno `set_rcvar $_l` && [ -n "$_ldir" ]; then |
| 58 | echo "${_ldir}/var/run/log" >> $_sockfile |
| 59 | fi |
| 60 | done |
| 61 | |
| 62 | # If other sockets have been provided, change run_rc_command()'s |
| 63 | # internal copy of $rsyslogd_flags to force use of specific |
| 64 | # rsyslogd sockets. |
| 65 | # |
| 66 | if [ -s $_sockfile ]; then |
| 67 | echo "/var/run/log" >> $_sockfile |
| 68 | eval $evalargs |
| 69 | fi |
| 70 | |
| 71 | return 0 |
| 72 | } |
| 73 | |
| 74 | set_socketlist() |
| 75 | { |
| 76 | _socketargs= |
| 77 | for _s in `cat $_sockfile | tr '\n' ' '` ; do |
| 78 | _socketargs="-l $_s $_socketargs" |
| 79 | done |
| 80 | echo $_socketargs |
| 81 | } |
| 82 | load_rc_config $name |
| 83 | run_rc_command "$1" |