0


I have a problem, crontab refuse to coop at all. I read a lot about it, and obviously this always should work:

* * * * env > /tmp/env.output

I wait but no env.output appears. What I find funny though is where crontab -e saves:

/tmp/crontab.i2ZQzh

I hope anyone has an idea, I am tired of starting my backups manually. I tired some backup software too, bt they doesn't work very well, some (small) disadvantages everywhere, I rely on rsync.

Thanks, regards, Dag

1
  • Please edit your question to include whose crontab are you editing, and how - which editor is being used, and how are you saving/exiting from it? Jul 29, 2017 at 10:40

2 Answers 2

1

You are missing the user part, the correct syntax is:

* * * * * root env > /tmp/env.output

Replace the root with the user you want to run the command with.

1
  • Note that this is only the case for the system-wide cron jobs in /etc/crontab and /etc/cron.d; user crontabs (including root's, as accessed via sudo crontab -e) do not have this additional field Jul 29, 2017 at 10:38
0

I assume from your statement that you were using the command crontab -e. You can verify the crontab entries by looking in '/var/spool/cron/crontabs' for the cron entries. (different nix flavors might have it in slightly different paths)

I would also suggest fully qualifying the path. Instead do: which env

/usr/bin/env

so change the entry to:

* * * * /usr/bin/env > /tmp/env.output

If this does not rectify your issue, you will need to specify which nix flavor you are using.

10
  • It seems I have an other problem. I must start this completly from the core. When I edit with crontab -e, I can but whatsoever in there, at save it only do what was in the firstmost entry which was "touch >/tmp/testing.txt " this appears all the time.
    – DJNJ
    Jul 29, 2017 at 8:34
  • What unix version are you using?
    – john
    Jul 29, 2017 at 8:41
  • Linux CD03B 4.4.0-87-generic #110~14.04.1-Ubuntu SMP Tue Jul 18 14:51:32 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
    – DJNJ
    Jul 29, 2017 at 9:16
  • Now I bring it to output a file, there where it should be (home/user/tst.txt), but the file is empty. Doesnt matter which command; it makes the file but doesn't execute the command.
    – DJNJ
    Jul 29, 2017 at 9:34
  • I have a script /home/user/tst.sh:<br>
    – DJNJ
    Jul 29, 2017 at 15:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .