@@ -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
@@ -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-configuration>
(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'.