* Declarative specification of the system cron jobs. Ideally
this would abstract over the Crontab syntax though. svn path=/nixos/trunk/; revision=10447
This commit is contained in:
parent
7521d6c49a
commit
9f62e1a6a5
@ -528,6 +528,24 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
cron = {
|
||||||
|
|
||||||
|
systemCronJobs = mkOption {
|
||||||
|
default = [];
|
||||||
|
example = [
|
||||||
|
"* * * * * test ls -l / > /tmp/cronout 2>&1"
|
||||||
|
"* * * * * eelco echo Hello World > /home/eelco/cronout"
|
||||||
|
];
|
||||||
|
description = ''
|
||||||
|
A list of Cron jobs to be appended to the system-wide
|
||||||
|
crontab. See the manual page for crontab for the expected
|
||||||
|
format.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
ttyBackgrounds = {
|
ttyBackgrounds = {
|
||||||
|
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
|
@ -1,15 +1,35 @@
|
|||||||
{cron}:
|
{pkgs, config}:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
systemCronJobs = config.services.cron.systemCronJobs;
|
||||||
|
|
||||||
|
systemCronJobsFile = pkgs.writeText "system-crontab" ''
|
||||||
|
SHELL=${pkgs.bash}/bin/sh
|
||||||
|
PATH=${pkgs.coreutils}/bin
|
||||||
|
MAILTO=
|
||||||
|
${pkgs.lib.concatStrings (map (job: job + "\n") systemCronJobs)}
|
||||||
|
'';
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
name = "cron";
|
name = "cron";
|
||||||
|
|
||||||
job = "
|
extraEtc = [
|
||||||
description \"Cron daemon\"
|
# The system-wide crontab.
|
||||||
|
{ source = systemCronJobsFile;
|
||||||
|
target = "crontab";
|
||||||
|
mode = "0600"; # Cron requires this.
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
start on startup
|
job = ''
|
||||||
stop on shutdown
|
description "Cron daemon"
|
||||||
|
|
||||||
respawn ${cron}/sbin/cron -n
|
start on startup
|
||||||
";
|
stop on shutdown
|
||||||
|
|
||||||
|
respawn ${pkgs.cron}/sbin/cron -n
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ let
|
|||||||
|
|
||||||
# Cron daemon.
|
# Cron daemon.
|
||||||
(import ../upstart-jobs/cron.nix {
|
(import ../upstart-jobs/cron.nix {
|
||||||
inherit (pkgs) cron;
|
inherit config pkgs;
|
||||||
})
|
})
|
||||||
|
|
||||||
# Name service cache daemon.
|
# Name service cache daemon.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user