I have this command to run in the cronjob
/bin/mkdir /var/www/html/webfiles/subdir/mobile/archives/$(date +%Y%m%d)
It creates current date folder fine.
But when i make it's cron like this example: 59 10 * * * /bin/mkdir /var/www/html/webfiles/subdir/mobile/archives/$(date +%Y%m%d)
It does not work at all ?
I have tried all things reboot, restart crond etc.
Running from root user.
Thanks
In a crontab, the "%" character has to be escaped by backslash "\".
See the man page, man 5 crontab
:
The "sixth" field (the rest of the line) specifies the command to be run. The entire command portion of the line, up to a newline or a "%" character, will be executed by /bin/sh or by the shell specified in the SHELL variable of the cronfile. A "%" character in the command, unless escaped with a backslash (\), will be changed into newline characters, and all data after the first % will be sent to the command as standard input.