From 16cfab7b5ea410252a56cd98a504cbf1bfba1c3b Mon Sep 17 00:00:00 2001 From: ssm Date: Tue, 22 May 2007 15:33:41 +0000 Subject: [PATCH] Add log rotation for /var/log/varnish/varnish.log git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1463 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/debian/dirs | 1 + varnish-cache/debian/rules | 1 + varnish-cache/debian/varnish.logrotate | 9 +++++++++ varnish-cache/debian/varnish.varnishlog.init | 12 +++++++++++- 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 varnish-cache/debian/varnish.logrotate diff --git a/varnish-cache/debian/dirs b/varnish-cache/debian/dirs index b591f2d8..1e28e136 100644 --- a/varnish-cache/debian/dirs +++ b/varnish-cache/debian/dirs @@ -1,4 +1,5 @@ etc/varnish +etc/logrotate.d usr/bin usr/lib usr/sbin diff --git a/varnish-cache/debian/rules b/varnish-cache/debian/rules index 9d7b8904..5be9d81f 100755 --- a/varnish-cache/debian/rules +++ b/varnish-cache/debian/rules @@ -69,6 +69,7 @@ install: build $(MAKE) install DESTDIR=$(CURDIR)/debian/varnish install -m 644 $(CURDIR)/etc/default.vcl $(CURDIR)/debian/varnish/etc/varnish/ install -m 644 $(CURDIR)/debian/lintian-override $(CURDIR)/debian/varnish/usr/share/lintian/overrides/varnish + install -m 644 $(CURDIR)/debian/varnish.logrotate $(CURDIR)/debian/varnish/etc/logrotate.d/varnish # Build architecture-independent files here. diff --git a/varnish-cache/debian/varnish.logrotate b/varnish-cache/debian/varnish.logrotate new file mode 100644 index 00000000..365cf7cf --- /dev/null +++ b/varnish-cache/debian/varnish.logrotate @@ -0,0 +1,9 @@ +/var/log/varnish/varnish.log { + daily + rotate 7 + compress + delaycompress + postrotate + /usr/sbin/invoke-rc.d varnishlog reload > /dev/null + endscript +} diff --git a/varnish-cache/debian/varnish.varnishlog.init b/varnish-cache/debian/varnish.varnishlog.init index def543a2..26af5319 100755 --- a/varnish-cache/debian/varnish.varnishlog.init +++ b/varnish-cache/debian/varnish.varnishlog.init @@ -52,12 +52,22 @@ case "$1" in log_end_msg 1 fi ;; + reload) + log_daemon_msg "Reloading $DESC" + log_progress_msg $NAME + if kill -HUP $(cat $PIDFILE) >/dev/null 2>&1; then + log_end_msg 0 + else + log_end_msg 1 + exit 1 + fi + ;; restart|force-reload) $0 stop $0 start ;; *) - log_success_msg "Usage: $0 {start|stop|restart|force-reload}" + log_success_msg "Usage: $0 {start|stop|restart|force-reload|reload}" exit 1 ;; esac -- 2.39.5