[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: on reloading services from logrotate



On Tue, 18 Nov 2014, Helmut Grohne wrote:

> From this little exercise, it seems that it is not well understood in
> what way services should be signalled after log rotation. In particular,
> it seems to me that service and invoke-rc.d should not be both valid. So

I’ve experimented a bit with this for a package I made
at work (similar to d-push, so this would also apply to
it), which has long-running server-side PHP scripts under
a webserver:

/var/log/simkolab/*.log {
	compress
	create 0640 www-data adm
	daily
	delaycompress
	missingok
	notifempty
	lastaction
		if /usr/sbin/service apache2 status >/dev/null; then
			(/usr/sbin/service apache2 stop || :)
			/usr/sbin/service apache2 start
		fi >/dev/null
	endscript
	rotate 255
	sharedscripts
	shred
	start 0
}

This works at least under sysvinit. I don’t know whether this
is possible using invoke-rc.d though.

Stopping then starting is a hard requirement in this case, to
get rid of the long-running processes. (This also led to all
sorts of shenanigans in the {pre,post}{inst,rm} maintainer
scripts.)

But if there’s a better way to do that (note: we need it to run
on squeeze for another month or two, then wheezy), please advice ☺

bye,
//mirabilos
-- 
tarent solutions GmbH
Rochusstraße 2-4, D-53123 Bonn • http://www.tarent.de/
Tel: +49 228 54881-393 • Fax: +49 228 54881-235
HRB 5168 (AG Bonn) • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg


Reply to: