From 0bb54ba02b0512be46024b33279ff0dddea7e2d7 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Wed, 2 Dec 2009 05:50:04 +0100 Subject: [PATCH] rsyslog: improved rc script, logrotate file from Gentoo. Bumprev. --HG-- extra : convert_revision : 4d4ebf704061ff320903a47dc9aaf37bd37e4a76 --- srcpkgs/rsyslog/files/rsyslog.logrotate | 5 ++--- srcpkgs/rsyslog/files/rsyslogd.confd | 13 +++++++++++++ srcpkgs/rsyslog/files/rsyslogd.rc | 18 +++++++++++++++--- srcpkgs/rsyslog/template | 7 +++++-- 4 files changed, 35 insertions(+), 8 deletions(-) create mode 100644 srcpkgs/rsyslog/files/rsyslogd.confd diff --git a/srcpkgs/rsyslog/files/rsyslog.logrotate b/srcpkgs/rsyslog/files/rsyslog.logrotate index 6721a7d0185..aa502c4de8e 100644 --- a/srcpkgs/rsyslog/files/rsyslog.logrotate +++ b/srcpkgs/rsyslog/files/rsyslog.logrotate @@ -1,8 +1,7 @@ -/var/log/messages /var/log/dmesg /var/log/lastlog /var/log/secure { +/var/log/messages /var/log/dmesg /var/log/maillog /var/log/lastlog /var/log/secure { missingok sharedscripts postrotate - kill -HUP $(cat /var/run/rsyslogd.pid 2>/dev/null) \ - 2>/dev/null || true + /etc/init.d/rsyslogd reload >/dev/null 2>&1 || true endscript } diff --git a/srcpkgs/rsyslog/files/rsyslogd.confd b/srcpkgs/rsyslog/files/rsyslogd.confd new file mode 100644 index 00000000000..80e8e688dd6 --- /dev/null +++ b/srcpkgs/rsyslog/files/rsyslogd.confd @@ -0,0 +1,13 @@ +# Config file for /etc/init.d/rsyslog + +CONFIGFILE="/etc/rsyslog.conf" +PIDFILE="/var/run/rsyslogd.pid" + +# Options to rsyslogd +# See rsyslogd(8) for more details +# Notes: +# * Do not specify another PIDFILE but use the variable above to change the location +# * Do not specify another CONFIGFILE but use the variable above to change the location +# * "-c4" tells rsyslog to _not_ run in sysklogd compatibility mode + +RSYSLOGD_OPTS="-c4" diff --git a/srcpkgs/rsyslog/files/rsyslogd.rc b/srcpkgs/rsyslog/files/rsyslogd.rc index 5ec9a410cbb..ddcc1d15671 100644 --- a/srcpkgs/rsyslog/files/rsyslogd.rc +++ b/srcpkgs/rsyslog/files/rsyslogd.rc @@ -1,11 +1,23 @@ #!/sbin/runscript -pidfile=${rsyslogd_pid:-/var/run/rsyslogd.pid} +pidfile=${PIDFILE} command=/usr/sbin/rsyslogd -config_file=${rsyslogd_conf:-/etc/rsyslog.conf} -command_args="${rsyslogd_args} -c4 -i ${pidfile} -f ${config_file}" +command_args="${RSYSLOGD_OPTS} -i ${pidfile} -f ${CONFIGFILE}" +opts="reload" depend() { provide logger } + +reload() +{ + if [ ! -f "${PIDFILE}" ]; then + eerror "rsyslogd not running" + return 1 + fi + ebegin "Reloading configuration and re-opening log files" + start-stop-daemon --stop --oknodo --signal HUP \ + --pidfile "${PIDFILE}" + eend $? +} diff --git a/srcpkgs/rsyslog/template b/srcpkgs/rsyslog/template index 6e0585d6b67..c26dc4b8c9c 100644 --- a/srcpkgs/rsyslog/template +++ b/srcpkgs/rsyslog/template @@ -1,6 +1,7 @@ # Template file for 'rsyslog' pkgname=rsyslog version=4.4.2 +revision=1 distfiles="http://download.rsyslog.com/$pkgname/$pkgname-$version.tar.gz" build_style=gnu_configure configure_args="--enable-gnutls" @@ -13,7 +14,7 @@ long_desc=" filtering on any message part, and fine grain output format control." subpackages="$pkgname-gnutls" -conf_files="/etc/rsyslog.conf" +conf_files="/etc/rsyslog.conf /etc/conf.d/rsyslogd" openrc_services="rsyslogd default" Add_dependency build pkg-config @@ -23,8 +24,10 @@ Add_dependency full zlib post_install() { - install -d ${DESTDIR}/etc/init.d ${DESTDIR}/etc/logrotate.d + install -d ${DESTDIR}/etc/init.d ${DESTDIR}/etc/logrotate.d \ + ${DESTDIR}/etc/conf.d install -m755 ${FILESDIR}/rsyslogd.rc ${DESTDIR}/etc/init.d/rsyslogd + install -m644 ${FILESDIR}/rsyslogd.confd ${DESTDIR}/etc/conf.d/rsyslogd install -m644 ${FILESDIR}/rsyslog.conf ${DESTDIR}/etc/rsyslog.conf install -m644 ${FILESDIR}/rsyslog.logrotate \ ${DESTDIR}/etc/logrotate.d/rsyslog