I'm trying to get execute a cron job everyday at noon but i can't get it to run. To test it i even tried something like a simple create command but it never runs, it seems as if the file isn't even used. I also can't see anything going wrong in the log.
0 12 * * * mkdir /path/to/folder
So is there something wrong with this line or should i look elsewhere?
I created the crontab as root with crontab -e
Best Answer
cron
does not know where to findmkdir
. So if you do not include aPATH
in your cron then always use absolute paths. This works:0 12 * * * /bin/mkdir /path/to/folder
Have a look at the part starting with
using cron
in the link. You can put a path and other variables at the top ofcron
like so:That way you have access to
/sbin/
,/bin/
,/usr/sbin/
and/usr/bin/
.I myself prefer to only include a script in
cron
and set the commands inside that script.