diff --git a/system/options.nix b/system/options.nix index d15c21645458..3e8828fdb735 100644 --- a/system/options.nix +++ b/system/options.nix @@ -654,6 +654,11 @@ in cron = { + mailto = mkOption { + default = ""; + description = " The job output will be mailed to this email address. "; + }; + systemCronJobs = mkOption { default = []; example = [ @@ -663,7 +668,8 @@ in description = '' A list of Cron jobs to be appended to the system-wide crontab. See the manual page for crontab for the expected - format. + format. If you want to get the results mailed you must setuid + sendmail. See ''; }; diff --git a/upstart-jobs/cron.nix b/upstart-jobs/cron.nix index e2212b4c575c..209eb562fa9e 100644 --- a/upstart-jobs/cron.nix +++ b/upstart-jobs/cron.nix @@ -20,7 +20,7 @@ let systemCronJobsFile = pkgs.writeText "system-crontab" '' SHELL=${pkgs.bash}/bin/sh PATH=${pkgs.coreutils}/bin:${pkgs.findutils}/bin:${pkgs.gnused}/bin:${pkgs.su}/bin - MAILTO= + MAILTO="${config.services.cron.mailto}" ${pkgs.lib.concatStrings (map (job: job + "\n") systemCronJobs)} '';