all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] gnu: rottlog: rotate messages daily.
@ 2016-08-11 10:52 Jan Nieuwenhuizen
  2016-09-07  9:52 ` Ludovic Courtès
  0 siblings, 1 reply; 13+ messages in thread
From: Jan Nieuwenhuizen @ 2016-08-11 10:52 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 921 bytes --]

Hi!

Using the attached patch and the configuration below, rottlog
actually rotates /var/log/messages daily.

Greetings,
Jan

--8<---------------cut here---------------start------------->8---

(use-package-modules admin)
(use-service-modules mcron)

(define rottlog-job
  #~(job '(next-hour '(5))
         (lambda ()
           (system (string-append  #$rottlog "/sbin/rottlog")))))

(define updatedb-job
  ;; Run 'updatedb' at 3AM every day.  Here we write the
  ;; job's action as a Scheme procedure.
  #~(job '(next-hour '(3))
         (lambda ()
           (execl (string-append #$findutils "/bin/updatedb")
                  "updatedb"
                  "--prunepaths=/tmp /var/tmp /gnu/store"))))

...

(operating-system
     ...
    (services
      ...

      (mcron-service (list rottlog-job
                           updatedb-job))
     ...
))
--8<---------------cut here---------------end--------------->8---


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-rottlog-rotate-messages-daily.patch --]
[-- Type: text/x-patch, Size: 2002 bytes --]

From c7fc570327faeb50503494b370a2f5ab21d4049b Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Sat, 18 Jun 2016 22:37:48 +0200
Subject: [PATCH] gnu: rottlog: rotate messages daily.

* gnu/packages/admin.scm (rottlog): Set packdir in etc/rc; fixes rotating.
Rename weekly to daily; rotates /var/log/messages daily.
---
 gnu/packages/admin.scm | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index eada796..f8ba6ef 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -731,11 +731,21 @@ over ssh connections.")
                                               (assoc-ref %outputs "out")
                                               "/etc")
                                "--localstatedir=/var")
-       #:phases (alist-cons-after
-                 'install 'install-info
-                 (lambda _
-                   (zero? (system* "make" "install-info")))
-                 %standard-phases)))
+       #:phases (modify-phases %standard-phases
+                  (add-after 'build 'set-packdir
+                    (lambda _
+                      (substitute* "rc/rc"
+                        (("packdir=\"\"")
+                         "packdir=\"/var/log\""))))
+                  (add-after 'install 'install-daily
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((out (assoc-ref outputs "out")))
+                        (zero? (system* "mv"
+                                        (string-append out "/etc/weekly")
+                                        (string-append out "/etc/daily"))))))
+                  (add-after 'install 'install-info
+                    (lambda _
+                      (zero? (system* "make" "install-info")))))))
     (native-inputs `(("texinfo" ,texinfo)
                      ("util-linux" ,util-linux))) ; for 'cal'
     (home-page "http://www.gnu.org/software/rottlog/")
-- 
2.9.2


[-- Attachment #3: Type: text/plain, Size: 154 bytes --]


-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-10-02 22:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-11 10:52 [PATCH] gnu: rottlog: rotate messages daily Jan Nieuwenhuizen
2016-09-07  9:52 ` Ludovic Courtès
2016-09-07 12:32   ` Jan Nieuwenhuizen
2016-09-09  5:26     ` Jan Nieuwenhuizen
2016-09-11 13:30       ` Ludovic Courtès
2016-09-12 21:35         ` Jan Nieuwenhuizen
2016-09-13 21:41           ` Ludovic Courtès
2016-09-14 18:30             ` Jan Nieuwenhuizen
2016-09-20  5:15               ` Ludovic Courtès
2016-09-20 20:47                 ` Jan Nieuwenhuizen
2016-09-21 15:32                   ` Ludovic Courtès
2016-09-22 20:51                     ` Jan Nieuwenhuizen
2016-10-02 22:39                       ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.