On 01/04/20 14:59, Stefan Raspl wrote: > On 2020-03-31 23:02, Paolo Bonzini wrote: >> On 31/03/20 22:00, Stefan Raspl wrote: >>> From: Stefan Raspl <raspl@xxxxxxxxxx> >>> >>> To integrate with logrotate, we have a signal handler that will re-open >>> the logfile. >>> Assuming we have a systemd unit file with >>> ExecStart=kvm_stat -dtc -s 10 -L /var/log/kvm_stat.csv >>> ExecReload=/bin/kill -HUP $MAINPID >>> and a logrotate config featuring >>> postrotate >>> /bin/systemctl restart kvm_stat.service >> >> Does reload work too? > > Reload and restart work fine - any specific concerns or areas to look for? No, I would just put reload in the postrotate script. >>> + if opts.log_to_file: >>> + f.close() >> >> "if f:"? > > I'd argue the former is a lot more telling/easier to read - one of the downsides > of using extremely short variable names like 'f'. Fair enough. Paolo