Merge lp:~jamesodhunt/ubuntu/trusty/upstart/periodic-logrotate-using-events into lp:ubuntu/trusty/upstart

Proposed by James Hunt
Status: Merged
Merged at revision: 1547
Proposed branch: lp:~jamesodhunt/ubuntu/trusty/upstart/periodic-logrotate-using-events
Merge into: lp:ubuntu/trusty/upstart
Diff against target: 69 lines (+25/-4)
3 files modified
debian/changelog (+9/-0)
debian/upstart.cron.hourly (+10/-0)
debian/user-conf/logrotate.conf (+6/-4)
To merge this branch: bzr merge lp:~jamesodhunt/ubuntu/trusty/upstart/periodic-logrotate-using-events
Reviewer Review Type Date Requested Status
Dimitri John Ledkov core-dev Approve
Review via email: mp+212569@code.launchpad.net

Description of the change

Use events and cron hourly snippet to rotate Session Init logs.

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) :
review: Approve (core-dev)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-03-11 16:12:00 +0000
3+++ debian/changelog 2014-03-25 10:07:29 +0000
4@@ -1,3 +1,12 @@
5+upstart (1.12.1-0ubuntu2) UNRELEASED; urgency=medium
6+
7+ * debian/upstart.cron.hourly: hourly cron job to emit the 'rotate-logs'
8+ event.
9+ * debian/user-conf/logrotate.conf: Run 1 minute after session startup
10+ and whenever the 'rotate-logs' event is emitted.
11+
12+ -- James Hunt <james.hunt@ubuntu.com> Tue, 25 Mar 2014 09:47:16 +0000
13+
14 upstart (1.12.1-0ubuntu1) trusty; urgency=medium
15
16 [ Dimitri John Ledkov ]
17
18=== added file 'debian/upstart.cron.hourly'
19--- debian/upstart.cron.hourly 1970-01-01 00:00:00 +0000
20+++ debian/upstart.cron.hourly 2014-03-25 10:07:29 +0000
21@@ -0,0 +1,10 @@
22+# Emit an Upstart system event, that will propagate to the Session Inits
23+# via the upstart-event-bridge(8), requesting that the Session Inits
24+# rotate their logs.
25+#
26+# Note that system-level Upstart logs are handled separately using a
27+# logrotate script.
28+
29+[ -x /sbin/initctl ] || exit 0
30+
31+initctl emit rotate-logs
32
33=== modified file 'debian/user-conf/logrotate.conf'
34--- debian/user-conf/logrotate.conf 2013-09-26 14:09:41 +0000
35+++ debian/user-conf/logrotate.conf 2014-03-25 10:07:29 +0000
36@@ -7,11 +7,13 @@
37
38 description "Rotate job log files"
39
40-start on startup
41+start on startup or :sys:rotate-logs
42+
43+task
44
45 pre-start script
46
47-logrotate=$(command -v logrotate)
48+logrotate=$(command -v logrotate 2>/dev/null || :)
49
50 # logrotate is not installed
51 [ -z "$logrotate" ] && exit 0
52@@ -27,7 +29,7 @@
53 script
54
55 # started by event, so allow time for main jobs to settle
56-[ -n "$UPSTART_EVENTS" ] && sleep 60
57+[ -n "$UPSTART_EVENTS" ] && [ "$UPSTART_EVENTS" = startup ] && sleep 60
58
59 statedir=${XDG_CACHE_HOME:-$HOME/.cache}/logrotate
60 statefile="$statedir/status"
61@@ -41,7 +43,7 @@
62
63 cat <<EOF >$conf
64 "$logdir/*.log" {
65- daily
66+ hourly
67 missingok
68 rotate 7
69 compress

Subscribers

People subscribed via source and target branches

to all changes: