I am setting up a cron job using crontab -e
on a machine where I do not have a root privilege.
The initial command in crontab is like this:
0 10 * * * /bin/bash /path/myscript.sh >/path/log
I found the script did not run, since the system created an empty log file. Then I add 2>&1
at the end of the above command:
0 10 * * * /bin/bash /path/myscript.sh >/path/log 2>&1
And try to find errors of whatsoever. Strangely, with adding the 2>&1
, cron did not even create an empty log file. Nothing.
Any idea on what's going on here when adding the 2>&1
?