Each upstart/*-all-starter.conf use the same script to find the list of
daemons and their ids. Copy it over to the corresponding logrotate.conf
script instead of using a less reliable script based on initctl list
output.
If logrotate fails to run initctl reload on a daemon, it will keep
writing to the rotated log file, even after it is deleted and until it
fills the disk. By using the exact same shell snippet as the upstart
scripts used to start the daemon, all of them will be sent the HUP
signal and reopen the log file that was just rotated.
http://tracker.ceph.com/issues/7072 fixes #7072
Signed-off-by: Loic Dachary <loic@dachary.org>
fi
# Possibly reload twice, but depending on ceph.conf the reload above may be a no-op
if which initctl > /dev/null 2>&1 && [ -x `which initctl` ]; then
- # upstart reload isn't very helpful here:
- # https://bugs.launchpad.net/upstart/+bug/1012938
- initctl list \
- | sed -n 's/^\(ceph-\(mon\|osd\|mds\)\+\)[ \t]\+(\([^ \/]\+\)\/\([^ \/]\+\))[ \t]\+start\/.*$/\1 cluster=\3 id=\4/p' \
- | while read l; do
- initctl reload -- $l 2>/dev/null || :
- done
+ for daemon in osd mon mds ; do
+ find -L /var/lib/ceph/$daemon/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[A-Za-z0-9]+-[A-Za-z0-9._-]+' -printf '%P\n' \
+ | while read f; do
+ if [ -e "/var/lib/ceph/$daemon/$f/done" ] && [ -e "/var/lib/ceph/$daemon/$f/upstart" ] && [ ! -e "/var/lib/ceph/$daemon/$f/sysvinit" ]; then
+ cluster="${f%%-*}"
+ id="${f#*-}"
+
+ initctl reload ceph-$daemon cluster="$cluster" id="$id" 2>/dev/null || :
+ fi
+ done
+ done
fi
endscript
missingok
fi
# Possibly reload twice, but depending on ceph.conf the reload above may be a no-op
if which initctl > /dev/null 2>&1 && [ -x `which initctl` ]; then
- # upstart reload isn't very helpful here:
- # https://bugs.launchpad.net/upstart/+bug/1012938
- initctl list \
- | sed -n 's/^\(radosgw\+\)[ \t]\+(\([^ \/]\+\)\/\([^ \/]\+\))[ \t]\+start\/.*$/\1 cluster=\2 id=\3/p' \
- | while read l; do
- initctl reload -- $l 2>/dev/null || :
- done
+ find -L /var/lib/ceph/radosgw/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[A-Za-z0-9]+-[A-Za-z0-9._-]+' -printf '%P\n' \
+ | while read f; do
+ if [ -e "/var/lib/ceph/radosgw/$f/done" ]; then
+ cluster="${f%%-*}"
+ id="${f#*-}"
+ initctl reload radosgw cluster="$cluster" id="$id" 2>/dev/null || :
+ fi
+ done
fi
endscript
missingok