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
=== modified file 'debian/changelog'
--- debian/changelog 2014-03-11 16:12:00 +0000
+++ debian/changelog 2014-03-25 10:07:29 +0000
@@ -1,3 +1,12 @@
1upstart (1.12.1-0ubuntu2) UNRELEASED; urgency=medium
2
3 * debian/upstart.cron.hourly: hourly cron job to emit the 'rotate-logs'
4 event.
5 * debian/user-conf/logrotate.conf: Run 1 minute after session startup
6 and whenever the 'rotate-logs' event is emitted.
7
8 -- James Hunt <james.hunt@ubuntu.com> Tue, 25 Mar 2014 09:47:16 +0000
9
1upstart (1.12.1-0ubuntu1) trusty; urgency=medium10upstart (1.12.1-0ubuntu1) trusty; urgency=medium
211
3 [ Dimitri John Ledkov ]12 [ Dimitri John Ledkov ]
413
=== added file 'debian/upstart.cron.hourly'
--- debian/upstart.cron.hourly 1970-01-01 00:00:00 +0000
+++ debian/upstart.cron.hourly 2014-03-25 10:07:29 +0000
@@ -0,0 +1,10 @@
1# Emit an Upstart system event, that will propagate to the Session Inits
2# via the upstart-event-bridge(8), requesting that the Session Inits
3# rotate their logs.
4#
5# Note that system-level Upstart logs are handled separately using a
6# logrotate script.
7
8[ -x /sbin/initctl ] || exit 0
9
10initctl emit rotate-logs
011
=== modified file 'debian/user-conf/logrotate.conf'
--- debian/user-conf/logrotate.conf 2013-09-26 14:09:41 +0000
+++ debian/user-conf/logrotate.conf 2014-03-25 10:07:29 +0000
@@ -7,11 +7,13 @@
77
8description "Rotate job log files"8description "Rotate job log files"
99
10start on startup10start on startup or :sys:rotate-logs
11
12task
1113
12pre-start script14pre-start script
1315
14logrotate=$(command -v logrotate)16logrotate=$(command -v logrotate 2>/dev/null || :)
1517
16# logrotate is not installed18# logrotate is not installed
17[ -z "$logrotate" ] && exit 019[ -z "$logrotate" ] && exit 0
@@ -27,7 +29,7 @@
27script29script
2830
29# started by event, so allow time for main jobs to settle31# started by event, so allow time for main jobs to settle
30[ -n "$UPSTART_EVENTS" ] && sleep 6032[ -n "$UPSTART_EVENTS" ] && [ "$UPSTART_EVENTS" = startup ] && sleep 60
3133
32statedir=${XDG_CACHE_HOME:-$HOME/.cache}/logrotate34statedir=${XDG_CACHE_HOME:-$HOME/.cache}/logrotate
33statefile="$statedir/status"35statefile="$statedir/status"
@@ -41,7 +43,7 @@
4143
42cat <<EOF >$conf44cat <<EOF >$conf
43"$logdir/*.log" {45"$logdir/*.log" {
44 daily46 hourly
45 missingok47 missingok
46 rotate 748 rotate 7
47 compress49 compress

Subscribers

People subscribed via source and target branches

to all changes: