From patchwork Tue Dec 3 12:46:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Vollmert X-Patchwork-Id: 16356 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 5771117831; Tue, 3 Dec 2019 13:07:14 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 1141E1782E for ; Tue, 3 Dec 2019 13:07:14 +0000 (GMT) Received: from localhost ([::1]:53072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ic7tZ-0000IU-B8 for patchwork@mira.cbaines.net; Tue, 03 Dec 2019 08:07:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53414) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ic7c6-0002fQ-36 for guix-patches@gnu.org; Tue, 03 Dec 2019 07:49:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ic7c2-0001LW-If for guix-patches@gnu.org; Tue, 03 Dec 2019 07:49:09 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:33410) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ic7bz-0001Im-MH for guix-patches@gnu.org; Tue, 03 Dec 2019 07:49:06 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ic7bx-0002cA-J1 for guix-patches@gnu.org; Tue, 03 Dec 2019 07:49:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38429] [PATCH 1/5] document scron References: <20191129175356.12403-1-rob@vllmrt.net> In-Reply-To: <20191129175356.12403-1-rob@vllmrt.net> Resent-From: Robert Vollmert Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 03 Dec 2019 12:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38429 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38429@debbugs.gnu.org Cc: Robert Vollmert Received: via spool by 38429-submit@debbugs.gnu.org id=B38429.15753773109983 (code B ref 38429); Tue, 03 Dec 2019 12:49:01 +0000 Received: (at 38429) by debbugs.gnu.org; 3 Dec 2019 12:48:30 +0000 Received: from localhost ([127.0.0.1]:39373 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ic7bS-0002aq-0I for submit@debbugs.gnu.org; Tue, 03 Dec 2019 07:48:30 -0500 Received: from mout-p-101.mailbox.org ([80.241.56.151]:37264) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ic7bP-0002aX-Bw for 38429@debbugs.gnu.org; Tue, 03 Dec 2019 07:48:28 -0500 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 47S1xH00qwzKmhD; Tue, 3 Dec 2019 13:48:19 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id sRLwjYcAnGsl; Tue, 3 Dec 2019 13:48:15 +0100 (CET) From: Robert Vollmert Date: Tue, 3 Dec 2019 13:46:29 +0100 Message-Id: <20191203124632.1987-1-rob@vllmrt.net> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * doc/guix.texi: Add documentation for scron-service. --- The first in a series of supplementary patches on top of the base scron service patch, to be squashed into that commit. doc/guix.texi | 100 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 99 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index e0b831c7e8..1aafa01166 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -283,7 +283,7 @@ System Configuration Services * Base Services:: Essential system services. -* Scheduled Job Execution:: The mcron service. +* Scheduled Job Execution:: Cron services. * Log Rotation:: The rottlog service. * Networking Services:: Network setup, SSH daemon, etc. * X Window:: Graphical display. @@ -12890,6 +12890,104 @@ specifications,, mcron, GNU@tie{}mcron}). @end deftp +@cindex scron +@cindex scheduling jobs +The @code{(gnu services scron)} module provides an interface to +scron, a simple daemon to run jobs at scheduled times. scron is +similar to the traditional Unix @command{cron} daemon; +the main difference is that it is much simpler. + +Jobs are executed as root via the shell with working direction @code{/}. +Use @code{su(1)} or corresponding Guile functions +(@pxref{Processes,,, guile, GNU Guile Reference Manual}). + +The example below defines an operating system that runs the +@command{updatedb} (@pxref{Invoking updatedb,,, find, Finding Files}) +and the @command{guix gc} commands (@pxref{Invoking guix gc}) daily, as +well as the @command{mkid} command on behalf of an unprivileged user +(@pxref{mkid invocation,,, idutils, ID Database Utilities}). + +@lisp +(use-modules (guix) (gnu) (gnu services scron)) +(use-package-modules base idutils) + +(define updatedb-job + ;; Run 'updatedb' at 3AM every day. Here we write the + ;; job's action as a Scheme procedure. + (let* + ((exp #~(begin + (execl (string-append #$findutils "/bin/updatedb") + "updatedb" + "--prunepaths=/tmp /var/tmp /gnu/store"))) + (script (program-file "updatedb-job" exp)) + (scron-job + (schedule "0 3 * * *") + (command script)))) + +(define garbage-collector-job + ;; Collect garbage 5 minutes after midnight every day. + ;; The job's action is a shell command. + (scron-job + (schedule "5 0 * * *") + (command "guix gc -F 1G"))) + +(define idutils-job + ;; Update the index database as user "charlie" at 12:15PM + ;; and 19:15PM. This runs from the user's home directory. + (let* + ((cmd #~(string-append #$idutils "/bin/mkid src")) + (cmd-su #~(string-append "su -c '" #$cmd "' charlie"))) + (scron-job + (schedule "15 12,19 * * *") + (command cmd-su)))) + +(operating-system + ;; @dots{} + (services (cons (service scron-service-type + (scron-configuration + (jobs (list garbage-collector-job + updatedb-job + idutils-job)))) + %base-services))) +@end lisp + +@defvr {Scheme Variable} scron-service-type + +This is the type of the @code{scron} service, whose value is an +@code{scron-configuration} object. + +This service type can be the target of a service extension that provides +it additional job specifications (@pxref{Service Composition}). In +other words, it is possible to define services that provide additional +mcron jobs to run. +@end defvr + +@deftp {Data Type} scron-configuration +Data type representing the configuration of scron. + +@table @asis +@item @code{scron} (default: @var{scron}) +The scron package to use. + +@item @code{jobs} +This is a list of scron jobs. +@end table +@end deftp + +@deftp {Data Type} scron-job +Data type representing an scron job. + +@table @asis +@item @code{schedule} +The job schedule, in Vixie cron syntax. See the @code{scron(1)} +man page for more information. + +@item @code{command} +The shell command to run, as a value that lowers to a string. +@end table +@end deftp + + @node Log Rotation @subsection Log Rotation From patchwork Tue Dec 3 12:46:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Vollmert X-Patchwork-Id: 16355 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 61E9017831; Tue, 3 Dec 2019 13:06:49 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 319CC1782E for ; Tue, 3 Dec 2019 13:06:49 +0000 (GMT) Received: from localhost ([::1]:53036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ic7tA-0008Rr-ID for patchwork@mira.cbaines.net; Tue, 03 Dec 2019 08:06:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53240) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ic7c4-0002eh-Ou for guix-patches@gnu.org; Tue, 03 Dec 2019 07:49:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ic7bz-0001Ja-Kh for guix-patches@gnu.org; Tue, 03 Dec 2019 07:49:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:33412) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ic7bz-0001J5-2t for guix-patches@gnu.org; Tue, 03 Dec 2019 07:49:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ic7by-0002cH-1Z for guix-patches@gnu.org; Tue, 03 Dec 2019 07:49:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38429] [PATCH 2/5] scron-service: remove job defaults Resent-From: Robert Vollmert Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 03 Dec 2019 12:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38429 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38429@debbugs.gnu.org Cc: Robert Vollmert Received: via spool by 38429-submit@debbugs.gnu.org id=B38429.15753773119992 (code B ref 38429); Tue, 03 Dec 2019 12:49:01 +0000 Received: (at 38429) by debbugs.gnu.org; 3 Dec 2019 12:48:31 +0000 Received: from localhost ([127.0.0.1]:39376 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ic7bT-0002b5-FM for submit@debbugs.gnu.org; Tue, 03 Dec 2019 07:48:31 -0500 Received: from mout-p-201.mailbox.org ([80.241.56.171]:50818) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ic7bR-0002ab-Rp for 38429@debbugs.gnu.org; Tue, 03 Dec 2019 07:48:30 -0500 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 47S1xM03xfzQlCC; Tue, 3 Dec 2019 13:48:23 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id Twmtn6ssUs8F; Tue, 3 Dec 2019 13:48:20 +0100 (CET) From: Robert Vollmert Date: Tue, 3 Dec 2019 13:46:30 +0100 Message-Id: <20191203124632.1987-2-rob@vllmrt.net> In-Reply-To: <20191203124632.1987-1-rob@vllmrt.net> References: <20191203124632.1987-1-rob@vllmrt.net> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches --- gnu/services/scron.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnu/services/scron.scm b/gnu/services/scron.scm index 0ea7cc9698..990ae8f0e2 100644 --- a/gnu/services/scron.scm +++ b/gnu/services/scron.scm @@ -61,8 +61,8 @@ (define-record-type* scron-job make-scron-job scron-job? - (schedule scron-job-schedule (default "* * * * *")) - (command scron-job-command (default '()))) + (schedule scron-job-schedule) + (command scron-job-command)) (define (crontab jobs) (apply mixed-text-file "crontab" From patchwork Tue Dec 3 12:46:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Vollmert X-Patchwork-Id: 16352 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 2CF6617831; Tue, 3 Dec 2019 12:49:52 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id D61FA1782E for ; Tue, 3 Dec 2019 12:49:51 +0000 (GMT) Received: from localhost ([::1]:52870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ic7cj-0002hV-4b for patchwork@mira.cbaines.net; Tue, 03 Dec 2019 07:49:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53245) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ic7c6-0002ei-Rp for guix-patches@gnu.org; Tue, 03 Dec 2019 07:49:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ic7bz-0001Jn-MZ for guix-patches@gnu.org; Tue, 03 Dec 2019 07:49:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:33411) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ic7by-0001J3-Vm for guix-patches@gnu.org; Tue, 03 Dec 2019 07:49:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ic7by-0002cX-Up for guix-patches@gnu.org; Tue, 03 Dec 2019 07:49:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38429] [PATCH 3/5] scron: Add description Resent-From: Robert Vollmert Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 03 Dec 2019 12:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38429 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38429@debbugs.gnu.org Cc: Robert Vollmert Received: via spool by 38429-submit@debbugs.gnu.org id=B38429.157537731710021 (code B ref 38429); Tue, 03 Dec 2019 12:49:02 +0000 Received: (at 38429) by debbugs.gnu.org; 3 Dec 2019 12:48:37 +0000 Received: from localhost ([127.0.0.1]:39382 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ic7bZ-0002bT-4V for submit@debbugs.gnu.org; Tue, 03 Dec 2019 07:48:37 -0500 Received: from mout-p-202.mailbox.org ([80.241.56.172]:21246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ic7bX-0002as-Bo for 38429@debbugs.gnu.org; Tue, 03 Dec 2019 07:48:35 -0500 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 47S1xT544PzQlD6; Tue, 3 Dec 2019 13:48:29 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id CHzHop4GUSL8; Tue, 3 Dec 2019 13:48:21 +0100 (CET) From: Robert Vollmert Date: Tue, 3 Dec 2019 13:46:31 +0100 Message-Id: <20191203124632.1987-3-rob@vllmrt.net> In-Reply-To: <20191203124632.1987-1-rob@vllmrt.net> References: <20191203124632.1987-1-rob@vllmrt.net> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches --- gnu/services/scron.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gnu/services/scron.scm b/gnu/services/scron.scm index 990ae8f0e2..b9b2983e96 100644 --- a/gnu/services/scron.scm +++ b/gnu/services/scron.scm @@ -89,6 +89,8 @@ (define scron-service-type (service-type (name 'scron) + (description + "Run the scron job scheduling daemon.") (extensions (list (service-extension shepherd-root-service-type scron-shepherd-services))) From patchwork Tue Dec 3 12:46:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Vollmert X-Patchwork-Id: 16353 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id CEB9517831; Tue, 3 Dec 2019 12:55:15 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 803F81782E for ; Tue, 3 Dec 2019 12:55:15 +0000 (GMT) Received: from localhost ([::1]:52926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ic7hx-0004Rl-2J for patchwork@mira.cbaines.net; Tue, 03 Dec 2019 07:55:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53306) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ic7c4-0002f1-TI for guix-patches@gnu.org; Tue, 03 Dec 2019 07:49:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ic7c2-0001L3-F0 for guix-patches@gnu.org; Tue, 03 Dec 2019 07:49:07 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:33409) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ic7bz-0001If-Ix for guix-patches@gnu.org; Tue, 03 Dec 2019 07:49:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ic7by-0002cN-Gn for guix-patches@gnu.org; Tue, 03 Dec 2019 07:49:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38429] [PATCH 4/5] scron: add system test Resent-From: Robert Vollmert Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 03 Dec 2019 12:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38429 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38429@debbugs.gnu.org Cc: Robert Vollmert Received: via spool by 38429-submit@debbugs.gnu.org id=B38429.157537731610014 (code B ref 38429); Tue, 03 Dec 2019 12:49:02 +0000 Received: (at 38429) by debbugs.gnu.org; 3 Dec 2019 12:48:36 +0000 Received: from localhost ([127.0.0.1]:39380 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ic7bX-0002bQ-Ps for submit@debbugs.gnu.org; Tue, 03 Dec 2019 07:48:36 -0500 Received: from mout-p-202.mailbox.org ([80.241.56.172]:21244) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ic7bV-0002ai-RE for 38429@debbugs.gnu.org; Tue, 03 Dec 2019 07:48:34 -0500 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 47S1xQ4QNgzQlD5; Tue, 3 Dec 2019 13:48:26 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id YkE2kizTB8k9; Tue, 3 Dec 2019 13:48:23 +0100 (CET) From: Robert Vollmert Date: Tue, 3 Dec 2019 13:46:32 +0100 Message-Id: <20191203124632.1987-4-rob@vllmrt.net> In-Reply-To: <20191203124632.1987-1-rob@vllmrt.net> References: <20191203124632.1987-1-rob@vllmrt.net> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches --- gnu/tests/base.scm | 86 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm index a891711844..b80e77be66 100644 --- a/gnu/tests/base.scm +++ b/gnu/tests/base.scm @@ -28,6 +28,7 @@ #:use-module (gnu services dbus) #:use-module (gnu services avahi) #:use-module (gnu services mcron) + #:use-module (gnu services scron) #:use-module (gnu services shepherd) #:use-module (gnu services networking) #:use-module (gnu packages base) @@ -48,6 +49,7 @@ %test-halt %test-cleanup %test-mcron + %test-scron %test-nss-mdns)) (define %simple-os @@ -720,6 +722,90 @@ non-ASCII names from /tmp.") (description "Make sure the mcron service works as advertised.") (value (run-mcron-test name)))) + +;;; +;;; Scron. +;;; + +(define %scron-os + ;; System with an scron service, with one scron job for "root" and one scron + ;; job for an unprivileged user. + (let ((job1 + (scron-job + (schedule "* * * * *") + (command "(id -u; id -g) > witness"))) + (job2 + (scron-job + (schedule "* * * * *") + (command "su -c '(id -u; id -g) > ~/witness' alice"))) + (job3 + (scron-job + (schedule "* * * * *") + (command "touch witness-touch")))) + (simple-operating-system + (service scron-service-type + (scron-configuration (jobs (list job1 job2 job3))))))) + +(define (run-scron-test name) + (define os + (marionette-operating-system + %scron-os + #:imported-modules '((gnu services herd) + (guix combinators)))) + + (define test + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (gnu build marionette) + (srfi srfi-64) + (ice-9 match)) + + (define marionette + (make-marionette (list #$(virtual-machine os)))) + + (mkdir #$output) + (chdir #$output) + + (test-begin "scron") + + (test-assert "service running" + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'scron)) + marionette)) + + ;; Make sure root's scron job runs, has its cwd set to "/", and + ;; runs with the right UID/GID. + (test-equal "root's job" + '(0 0) + (wait-for-file "/witness" marionette)) + + ;; Likewise for Alice's job. We cannot know what its GID is since + ;; it's chosen by 'groupadd', but it's strictly positive. + (test-assert "alice's job" + (match (wait-for-file "/home/alice/witness" marionette) + ((1000 gid) + (>= gid 100)))) + + ;; Last, the job that uses a command; allows us to test whether + ;; $PATH is sane. + (test-equal "root's job with command" + "" + (wait-for-file "/witness-touch" marionette + #:read '(@ (ice-9 rdelim) read-string))) + + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + + (gexp->derivation name test)) + +(define %test-scron + (system-test + (name "scron") + (description "Make sure the scron service works as advertised.") + (value (run-scron-test name)))) + ;;; ;;; Avahi and NSS-mDNS. From patchwork Tue Dec 3 12:46:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Vollmert X-Patchwork-Id: 16354 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9ABA917831; Tue, 3 Dec 2019 13:06:22 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 5FF551782E for ; Tue, 3 Dec 2019 13:06:22 +0000 (GMT) Received: from localhost ([::1]:53034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ic7sj-0008GP-K5 for patchwork@mira.cbaines.net; Tue, 03 Dec 2019 08:06:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57216) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ic7d0-00033c-Bv for guix-patches@gnu.org; Tue, 03 Dec 2019 07:50:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ic7cx-0003Sm-Ci for guix-patches@gnu.org; Tue, 03 Dec 2019 07:50:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:33420) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ic7cx-0003Se-9C for guix-patches@gnu.org; Tue, 03 Dec 2019 07:50:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ic7cx-0002eX-83 for guix-patches@gnu.org; Tue, 03 Dec 2019 07:50:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38429] [PATCH 5/5] gnu/services: Add description to mcron-service-type. Resent-From: Robert Vollmert Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 03 Dec 2019 12:50:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38429 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38429@debbugs.gnu.org Cc: Robert Vollmert Received: via spool by 38429-submit@debbugs.gnu.org id=B38429.157537735810132 (code B ref 38429); Tue, 03 Dec 2019 12:50:03 +0000 Received: (at 38429) by debbugs.gnu.org; 3 Dec 2019 12:49:18 +0000 Received: from localhost ([127.0.0.1]:39392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ic7cD-0002dM-Q8 for submit@debbugs.gnu.org; Tue, 03 Dec 2019 07:49:18 -0500 Received: from mout-p-101.mailbox.org ([80.241.56.151]:37292) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ic7cC-0002d8-1B for 38429@debbugs.gnu.org; Tue, 03 Dec 2019 07:49:16 -0500 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 47S1yF2W4yzKmdL; Tue, 3 Dec 2019 13:49:09 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id kE_CjPF4Od5C; Tue, 3 Dec 2019 13:49:06 +0100 (CET) From: Robert Vollmert Date: Tue, 3 Dec 2019 13:46:34 +0100 Message-Id: <20191203124632.1987-5-rob@vllmrt.net> In-Reply-To: <20191203124632.1987-1-rob@vllmrt.net> References: <20191203124632.1987-1-rob@vllmrt.net> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/mcron.go (mcron-service-type): Add description. --- This one is independent from the scron patches. gnu/services/mcron.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gnu/services/mcron.scm b/gnu/services/mcron.scm index 7238665404..1327516b49 100644 --- a/gnu/services/mcron.scm +++ b/gnu/services/mcron.scm @@ -130,6 +130,8 @@ files." (define mcron-service-type (service-type (name 'mcron) + (description + "Run the mcron job scheduling daemon.") (extensions (list (service-extension shepherd-root-service-type mcron-shepherd-services)