I have an Ubuntu 14.04.5 installed and I'm trying to run a cron but it does not work.
$ whoami
root
$ crontab -e
#append at the end of the file
* * * * * env > /tmp/env_root.output
#save and quit :wq
$ less /var/log/cron.log
......
Sep 22 20:15:01 myserver CRON[2993]: (root) CMD (env > /tmp/env_root.output)
$ ls -la /tmp/env_root.output
ls: cannot access /tmp/env_root.output: No such file or directory
Why is this? I am root and I should be able to edit files, the Cron log shows it as being changed, but no file is there. If I run the command in the current GNU BASH shell or even in /bin/sh it works but not in Cron.
What am I doing wrong? Does Ubuntu have something like SELinux that I might have enabled by mistake? I provision my server with Ansible and I am not the only person working on the Ansible roles.
Thank you
EDIT: This is how my /etc/crontab looks and it runs /usr/bin/myscript.sh https://paste.fedoraproject.org/433591/74650461/
* * * * * /usr/bin/env > /tmp/env_root.output
– heemayl Sep 22 '16 at 17:29None work :( > shoud work despite of the file not existing. I created the file and still no luck, it does not get populated. /usr/bin is in my path so adding full path does not help and sending stderr to the file does not work since env sends to stdout not stderr.
– ddreian Sep 22 '16 at 20:12env
by getting the path ofenv
by executing the commandwhich env
– Bidyut Aug 23 '17 at 15:51