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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content