From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id kF19HLltKGQpJAEASxT56A (envelope-from ) for ; Sat, 01 Apr 2023 19:45:29 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id +IJtHLltKGSXVQEA9RJhRA (envelope-from ) for ; Sat, 01 Apr 2023 19:45:29 +0200 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 22C413A72E for ; Sat, 1 Apr 2023 19:45:28 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pifHu-0005Fa-Sq; Sat, 01 Apr 2023 13:45:15 -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 1pifHj-000586-V6 for guix-patches@gnu.org; Sat, 01 Apr 2023 13:45:04 -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 1pifHj-0007wQ-2I for guix-patches@gnu.org; Sat, 01 Apr 2023 13:45:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pifHi-0001Dk-Da for guix-patches@gnu.org; Sat, 01 Apr 2023 13:45:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62465] [PATCH v4 3/3] services: mcron: Add user-name, user-group and supplementary-groups fields. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 01 Apr 2023 17:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62465 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62465@debbugs.gnu.org Cc: Bruno Victal , maxim.cournoyer@gmail.com Received: via spool by 62465-submit@debbugs.gnu.org id=B62465.16803710764636 (code B ref 62465); Sat, 01 Apr 2023 17:45:02 +0000 Received: (at 62465) by debbugs.gnu.org; 1 Apr 2023 17:44:36 +0000 Received: from localhost ([127.0.0.1]:38548 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pifHI-0001Ci-6F for submit@debbugs.gnu.org; Sat, 01 Apr 2023 13:44:36 -0400 Received: from smtpmciv3.myservices.hosting ([185.26.107.239]:40988) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pifHG-0001Ca-DM for 62465@debbugs.gnu.org; Sat, 01 Apr 2023 13:44:34 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv3.myservices.hosting (Postfix) with ESMTP id 7EAEF205DB; Sat, 1 Apr 2023 19:44:33 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 47C8E8009B; Sat, 1 Apr 2023 19:37:17 +0200 (CEST) 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 dTfXb07MRUlK; Sat, 1 Apr 2023 19:37:17 +0200 (CEST) Received: from guix-nuc.home.arpa (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id AF11C8009C; Sat, 1 Apr 2023 19:37:16 +0200 (CEST) From: Bruno Victal Date: Sat, 1 Apr 2023 18:35:55 +0100 Message-Id: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 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: 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 ARC-Seal: i=1; s=key1; d=yhetil.org; t=1680371129; a=rsa-sha256; cv=none; b=LQa2zaeROe4xwicjHyq5E5MFmQiT4zH+fwzpX7ySTz2XlOpcEh5YY3foaMdP3Hr+Q6tjTO wJ0XDU25L4++uvZD+Lgz3om7ku4JoUvXi5W8/RCcHSqBZb4eqCdrf6iFIcg90lsBh+8Ghm EP+U1AxMOse6/JvC/uS/gc/r0MwcfICKk9Jvaxns2sKUmOscoWFA8CXGAfInVJ7NP4/QuS Ox106Y9Hjz7T5mM7Ct88jFV4HS4D6vh79FsSuQVMvMYQ1HzTMdus5akzmI62O9gGCoYrrV DTrYtdrWTSJM5FTN39SrXeZfrs1DTXjxxJiuucXuklBg7LbbUGltX816h19htA== 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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1680371129; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: 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=SD8CbPPnFyyGgl/X+4vIpWKQLwaG1ymqdHPbF0stTQU=; b=EJ+lXi+uwVLs1csm5mkA0jOLAiV8l4eLulIkGG2rbteRCs33cjl1IMjbKG+ujI9DcR69vF JBVDpIyiQNCk0N6TNzKgcxm+oi6lGbXa4L6GbCanvt1QvPAArV1l/c75SdzX9IOu/qSsHk aRw1U8i0NqmD+toRS2gKDaBb0FyzLozWqBN5j+xxWm806GrsUIVTqNOSLxGQsU0msPUH/j hZEYJy6gEJ7eVmvO4qexqxd2N56t7JOggaPAsldaLOwFP0XhIioIlc3WEgEnMpQQeBn+mU oGRUd2tP5EQsujM9i0HMuXr7iNMD7bgufLd2xfGmaOKlymTxe+RM2GNPPCzueQ== 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" X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -3.53 X-Spam-Score: -3.53 X-Migadu-Queue-Id: 22C413A72E X-TUID: GTycTGkBoYPr Allows mcron to be launched with a different user. This is especially useful when configuring multiple instances. * gnu/services/mcron.scm (mcron-configuration)[user, group, supplementary-groups]: New field. (list-of-user-groups?): New predicate. (mcron-shepherd-services): Use newly added fields. * doc/guix.texi (Scheduled Job Execution): Update it. --- doc/guix.texi | 9 +++++++++ gnu/services/mcron.scm | 31 +++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index e2781cb439..1819e1386c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19387,6 +19387,15 @@ Scheduled Job Execution Set the shepherd service name to @code{mcron-@var{instance}}. This is useful when you want to have more than one mcron instance. +@item @code{user} (type: maybe-user-account) +Owner of the @command{mcron} process. + +@item @code{group} (type: maybe-user-group) +Owner group of the @command{mcron} process. + +@item @code{supplementary-groups} (type: maybe-list-of-user-groups) +List of supplementary groups of the @command{mcron} process. + @item @code{jobs} (default: @code{()}) (type: list-of-gexps) This is a list of gexps (@pxref{G-Expressions}), where each gexp corresponds to an mcron job specification (@pxref{Syntax, mcron job diff --git a/gnu/services/mcron.scm b/gnu/services/mcron.scm index 164ef0e723..b4e28fc65d 100644 --- a/gnu/services/mcron.scm +++ b/gnu/services/mcron.scm @@ -23,6 +23,7 @@ (define-module (gnu services mcron) #:use-module (gnu services configuration) #:use-module (gnu services shepherd) #:use-module (gnu packages guile-xyz) + #:use-module (gnu system accounts) #:use-module (guix deprecation) #:use-module (guix records) #:use-module (guix gexp) @@ -64,8 +65,14 @@ (define list-of-gexps? (define list-of-symbols? (list-of symbol?)) +(define list-of-user-groups? + (list-of user-group?)) + (define-maybe/no-serialization string) (define-maybe/no-serialization symbol) +(define-maybe/no-serialization user-account) +(define-maybe/no-serialization user-group) +(define-maybe/no-serialization list-of-user-groups) (define-configuration/no-serialization mcron-configuration (mcron @@ -82,6 +89,18 @@ (define-configuration/no-serialization mcron-configuration "Set the shepherd service name to @code{mcron-@var{instance}}. This is useful when you want to have more than one mcron instance.") + (user + maybe-user-account + "Owner of the @command{mcron} process.") + + (group + maybe-user-group + "Owner group of the @command{mcron} process.") + + (supplementary-groups + maybe-list-of-user-groups + "List of supplementary groups of the @command{mcron} process.") + (jobs (list-of-gexps '()) "This is a list of gexps (@pxref{G-Expressions}), where each gexp @@ -178,6 +197,7 @@ (define (shepherd-schedule-action mcron files) (define (mcron-shepherd-services config) (match-record config (mcron shepherd-requirement instance + user group supplementary-groups jobs log? log-file log-format date-format) (if (eq? jobs '()) '() ;nothing to do @@ -204,6 +224,17 @@ (define (mcron-shepherd-services config) '())) '()) #$@files) + #$@(if (maybe-value-set? user) + `(#:user ,(user-account-name user)) + '()) + #$@(if (maybe-value-set? group) + `(#:group ,(user-group-name group)) + '()) + #$@(if (maybe-value-set? supplementary-groups) + `(#:supplementary-groups + ,#~'#$(map user-group-name + supplementary-groups)) + '()) ;; Disable auto-compilation of the job files and ;; set a sane value for 'PATH'. -- 2.39.1