Cron truncating command lines when date command with format controls used

Solution Verified - Updated -

Issue

  • cron appears to be truncating the command line so the job does not complete/run.

  • Add cron jobs which use the date command like these:

34 10 * * * date +%m > /tmp/nb1
34 10 * * * date '+%m' > /tmp/nb2
34 10 * * * date "+%m" > /tmp/nb3
  • The jobs when run but not create the files in /tmp. cron log shows cron is truncating the command line before running it.
CROND[11853]: ($NAME) CMD (date +)
CROND[11855]: ($NAME) CMD (date '+)
CROND[11857]: ($NAME) CMD (date "+)
  • If format controls are not used, full command is executed.

Environment

  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.