This is the cron job I'm trying to run nightly:
0 20 * * * /data/code/scripts/foo.sh >/root/foo.$(date +%Y-%m-%d-%T).log 2>&1
When I run it from the command line, it works fine. But Cron doesn't appear to even try and run it.
Thoughts?
|
This is the cron job I'm trying to run nightly:
When I run it from the command line, it works fine. But Cron doesn't appear to even try and run it. Thoughts? |
||||
|
|
|
The % symbols need to be escaped in cron jobs. Put a backslash in front of each one. Late edit: I'm not sure how I missed this before but you are using a bash syntax for creating a subshell to run your
Alternatively, you could do the output redirection from within the script or (if that's not appropriate) write a wrapper script that calls the above one and does the output redirection. |
||||
|
|
|
You will possibly also need to use the full path to the It's probably located at |
|||
|
|