Cron issue: Why cronjob does not work when % sign is used in RHEL?
Issue
- I have following line in a cron file:
24 * * * * /bin/cp /etc/<file-name> "/tmp/<file-name>.txt.$(date +%Y%m%d%H%M%S)"
- Getting below errors after setting above cronjob
/bin/sh: -c: line 0: unexpected EOF while looking for matching `)'
/bin/sh: -c: line 1: syntax error: unexpected end of file
- What is wrong with the above cronjob?
Environment
- Red Hat Enterprise Linux (RHEL) 4
- Red Hat Enterprise Linux (RHEL) 5
- Red Hat Enterprise Linux (RHEL) 6
- Red Hat Enterprise Linux (RHEL) 7
- crond
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.