[Nix-dev] How do I get the system crontab to work?

Jeffrey David Johnson jefdaj at gmail.com
Sun Jul 12 22:23:22 CEST 2015


I see here that there are upstream issues with cron as far as setting user crontab entries:

http://lists.science.uu.nl/pipermail/nix-dev/2014-September/014120.html

But I'm having trouble setting the system ones as well. I think if they didn't work
at all a lot of other things would fail, so I must be setting something wrong. This
simple test doesn't put any files in /tmp or send any emails:

services.cron = {
  enable = true;
  mailto = "jefdaj at gmail.com";
  systemCronJobs = [
    "* * * * *  test ls -l / > /tmp/cronout 2>&1"
    "* * * * *  /nix/store/wc472nw0kyw0iwgl6352ii5czxd97js2-coreutils-8.23/bin/test /nix/store/wc472nw0kyw0iwgl6352ii5czxd97js2-coreutils-8.23/bin/ls -l / > /tmp/cronout 2>&1"
  ];
};

I've checked that it does get written to /etc/crontab:

SHELL=/nix/store/xlxjcjq3bnbwnzq82irlzwxhmx6fvc2w-bash-4.3-p33/bin/bash
PATH=/nix/store/fpqvi360cimx3h1kxdxfvkyip52d1i8y-system-path/bin:/nix/store/fpqvi360cimx3h1kxdxfvkyip52d1i8y-system-path/sbin
MAILTO="jefdaj at gmail.com"

NIX_CONF_DIR=/etc/nix
* * * * * test ls -l / > /tmp/cronout 2>&1
* * * * * /nix/store/wc472nw0kyw0iwgl6352ii5czxd97js2-coreutils-8.23/bin/test /nix/store/wc472nw0kyw0iwgl6352ii5czxd97js2-coreutils-8.23/bin/ls -l / > /tmp/cronout 2>&1

And that the test and ls binaries are on that PATH. Anything else I should try?
Jeff


More information about the nix-dev mailing list