[ovs-dev] Bug#729304: openvswitch-switch: logrotate error if directory "/var/run/openvswitch" does not exist
Alfredo Finelli
alf at computationes.de
Mon Nov 11 16:25:20 UTC 2013
Package: openvswitch-switch
Version: 1.9.3+git20131029-1
Severity: normal
Tags: patch
Some time after the last update I received email from the cron daemon with the
following error:
/etc/cron.daily/logrotate:
logrotate_script: 1: cd: can't cd to /var/run/openvswitch
After further inspection I noticed that part of the content of the file
"/etc/logrotate.d/openvswitch-switch" changed from this (pre update):
[...]
postrotate
if [ -e /var/run/openvswitch/ovs-vswitchd.pid ]; then
ovs-appctl -t ovs-vswitchd vlog/reopen
fi
if [ -e /var/run/openvswitch/ovsdb-server.pid ]; then
ovs-appctl -t ovsdb-server vlog/reopen
fi
endscript
to this (post update):
[...]
postrotate
for pidfile in `cd /var/run/openvswitch && echo *.pid`; do
ovs-appctl -t "${pidfile%%.pid}" vlog/reopen
done
endscript
If the openvswitch-switch package is installed but was not running since
the last reboot then the directory "/var/run/openvswitch" does not exist
and the cronjob that tries to rotate the logs has an error.
The problem is easily solved by the following patch. Best regards.
--- /etc/logrotate.d/openvswitch-switch 2013-10-29 17:30:47.000000000 +0100
+++ openvswitch-switch 2013-11-11 16:52:55.225330308 +0100
@@ -7,8 +7,10 @@
rotate 30
postrotate
# Tell Open vSwitch daemons to reopen their log files
- for pidfile in `cd /var/run/openvswitch && echo *.pid`; do
- ovs-appctl -t "${pidfile%%.pid}" vlog/reopen
- done
+ if [ -d /var/run/openvswitch ]; then
+ for pidfile in `cd /var/run/openvswitch && echo *.pid`; do
+ ovs-appctl -t "${pidfile%%.pid}" vlog/reopen
+ done
+ fi
endscript
}
More information about the dev
mailing list