From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id UNX7KUd6D2SoVwAASxT56A (envelope-from ) for ; Mon, 13 Mar 2023 20:32:23 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id SJDkKUd6D2RhrQAA9RJhRA (envelope-from ) for ; Mon, 13 Mar 2023 20:32:23 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5BAFB3C338 for ; Mon, 13 Mar 2023 20:32:23 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1678735943; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=FqecWx/x9Thu4PESzanIySWk3F0WM0Lj7zUwHghlais=; b=FctSFBlKNQnPRxsdwelbNpH4DdJwbPlDUCp41/FJEEDxq22myDU1IpjYc+glOHlUWNdFw7 5MCGqrN3zPVoMVTqU/d0LLphwFLpufa15/FER/kIbWIJdymYwGeWaANbIsBvYurHxjAlno +JXrIXxkrFTZ/uzgrC8mbt6Cmh6VVBRyuAkLzrq/t10/v1WN2kOWIiYBmiF6S+IWZ+U8zD +nx6gAyL820slTo0S6OGONvaaU32exDlWI5kKNBxubO1xeBnXp08xj47pGm3yEpiA6+VA0 dwSla1fo4PT1yRgNrrjIXUo1NxfsXZk+/88rvAFNKe7p/N4lZT/w3bjSGc3xdg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1678735943; a=rsa-sha256; cv=none; b=DeA7ybY0YfGERog4KdjjtBZM6PrHGbhC68RRfJUQJ2XRT0izk4sQeGAD5dwWQkWNMoosDf EDcTJaDmLVQehDrPIErTtDhOARns8omjJhiCsWgcLqa0aPY8TtG/qgjBHJ6RHdip+zwpBO lTh0SNx53YIzCPyn4y369/4FuOLN9uc4ZZ59/jyO0pzW+eLB8cEDLvWWhCL9EBheAeiXej SoKPsLTTkayAGMzadTtL2TfiqdfQcu1w8OquinXyryRQtzuWvmn8D2rFEDgtnkr0odK/C/ Vvij9sy7SH6Jp/Meui/X8O35caIbMwfIQ/Www2+mZ9I1Hj7vjGG7fcUWN52U8w== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbntu-0003TL-9E; Mon, 13 Mar 2023 15:32:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pbntq-0003T1-US for guix-patches@gnu.org; Mon, 13 Mar 2023 15:32:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pbntq-0000Bd-LD for guix-patches@gnu.org; Mon, 13 Mar 2023 15:32:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pbntq-0003JV-8U for guix-patches@gnu.org; Mon, 13 Mar 2023 15:32:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62169] [PATCH 3/3] services: mcron: Add log-file and date-format fields. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 13 Mar 2023 19:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62169 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62169@debbugs.gnu.org Cc: Bruno Victal Received: via spool by 62169-submit@debbugs.gnu.org id=B62169.167873586312651 (code B ref 62169); Mon, 13 Mar 2023 19:32:02 +0000 Received: (at 62169) by debbugs.gnu.org; 13 Mar 2023 19:31:03 +0000 Received: from localhost ([127.0.0.1]:35667 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pbnss-0003Hq-Dr for submit@debbugs.gnu.org; Mon, 13 Mar 2023 15:31:03 -0400 Received: from smtpm5.myservices.hosting ([185.26.105.236]:48642) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pbnsr-0003HV-50 for 62169@debbugs.gnu.org; Mon, 13 Mar 2023 15:31:01 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm5.myservices.hosting (Postfix) with ESMTP id 71ECB20D7B for <62169@debbugs.gnu.org>; Mon, 13 Mar 2023 20:30:59 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id C6539800A1; Mon, 13 Mar 2023 20:30:53 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id dCwzaShlIdUd; Mon, 13 Mar 2023 20:30:53 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 21A4A800A0; Mon, 13 Mar 2023 20:30:53 +0100 (CET) From: Bruno Victal Date: Mon, 13 Mar 2023 19:30:50 +0000 Message-Id: <93b9d69cf03ecb9933072b0911c1b291b4788bd6.1678735825.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: X-Migadu-Queue-Id: 5BAFB3C338 X-Spam-Score: -3.02 X-Migadu-Spam-Score: -3.02 X-Migadu-Scanner: scn0.migadu.com List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-TUID: VtIOVbSTWtSF * doc/guix.texi (Scheduled Job Execution): Document it. * gnu/services/mcron.scm (mcron-configuration)[log-file, date-format]: New field. (mcron-shepherd-services): Add log-file and date-format support. Use file-append instead of string-append. --- doc/guix.texi | 6 ++++++ gnu/services/mcron.scm | 31 +++++++++++++++++++++++++------ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 45d96b8fbb..6d47d36d22 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19347,12 +19347,18 @@ Scheduled Job Execution @item @code{log?} (default: @code{#t}) (type: boolean) Log messages to standard output. +@item @code{log-file} (default: @code{"/var/log/mcron.log"}) (type: string) +Log file location. + @item @code{log-format} (default: @code{"~1@@*~a ~a: ~a~%"}) (type: string) @code{(ice-9 format)} format string for log messages. The default value produces messages like @samp{@var{pid} @var{name}: @var{message}} (@pxref{Invoking mcron, Invoking,, mcron,GNU@tie{}mcron}). Each message is also prefixed by a timestamp by GNU Shepherd. +@item @code{date-format} (type: maybe-string) +@code{(srfi srfi-19)} format string for date. + @end table @end deftp @c %end of fragment diff --git a/gnu/services/mcron.scm b/gnu/services/mcron.scm index 9f3afecf62..dac213358c 100644 --- a/gnu/services/mcron.scm +++ b/gnu/services/mcron.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016, 2017, 2018, 2019, 2020 Ludovic Courtès ;;; Copyright © 2022 Maxim Cournoyer +;;; Copyright © 2023 Bruno Victal ;;; ;;; This file is part of GNU Guix. ;;; @@ -33,7 +34,9 @@ (define-module (gnu services mcron) mcron-configuration-mcron mcron-configuration-jobs mcron-configuration-log? + mcron-configuration-log-file mcron-configuration-log-format + mcron-configuration-date-format mcron-service-type)) @@ -55,6 +58,8 @@ (define-module (gnu services mcron) (define list-of-gexps? (list-of gexp?)) +(define-maybe/no-serialization string) + (define-configuration/no-serialization mcron-configuration (mcron (file-like mcron) @@ -70,12 +75,20 @@ (define-configuration/no-serialization mcron-configuration (boolean #t) "Log messages to standard output.") + (log-file + (string "/var/log/mcron.log") + "Log file location.") + (log-format (string "~1@*~a ~a: ~a~%") "@code{(ice-9 format)} format string for log messages. The default value produces messages like @samp{@var{pid} @var{name}: @var{message}} (@pxref{Invoking mcron, Invoking,, mcron, GNU@tie{}mcron}). -Each message is also prefixed by a timestamp by GNU Shepherd.")) +Each message is also prefixed by a timestamp by GNU Shepherd.") + + (date-format + maybe-string + "@code{(srfi srfi-19)} format string for date.")) (define (job-files mcron jobs) "Return a list of file-like object for JOBS, a list of gexps." @@ -144,7 +157,9 @@ (define (shepherd-schedule-action mcron files) (loop))))))))) (define (mcron-shepherd-services config) - (match-record config (mcron jobs log? log-format) + (match-record config (mcron jobs + log? log-file log-format + date-format) (if (eq? jobs '()) '() ; nothing to do (let ((files (job-files mcron jobs))) @@ -158,10 +173,14 @@ (define (mcron-shepherd-services config) (ice-9 match) ,@%default-modules)) (start #~(make-forkexec-constructor - (list (string-append #$mcron "/bin/mcron") + (list #$(file-append mcron "/bin/mcron") #$@(if log? - #~("--log" "--log-format" #$log-format) - #~()) + `("--log" "--log-format" ,log-format + ,@(if (maybe-value-set? date-format) + (list "--date-format" + date-format) + '())) + '()) #$@files) ;; Disable auto-compilation of the job files and @@ -172,7 +191,7 @@ (define (mcron-shepherd-services config) (remove (cut string-prefix? "PATH=" <>) (environ))) - #:log-file "/var/log/mcron.log")) + #:log-file #$log-file)) (stop #~(make-kill-destructor)) (actions (list (shepherd-schedule-action mcron files))))))))) -- 2.39.1