guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] gnu: rottlog: rotate messages daily.


From: Jan Nieuwenhuizen
Subject: [PATCH] gnu: rottlog: rotate messages daily.
Date: Thu, 11 Aug 2016 12:52:55 +0200

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---

>From c7fc570327faeb50503494b370a2f5ab21d4049b Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <address@hidden>
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

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]