Problem
I am trying to use the date(C) command from cron(C) but I get an error emailed to me from the cron daemon saying:
date: format conversion error'+++++++++++++++++++++++++++++++++++++++++++++++++Cron: The previous message is the standard output and standard error of one of your cron commands.
The date(C) syntax I am using is:
date +%d/%m/%yIt works from the command line and it used to work on my SCO OpenServer Release 5.0.2 or 5.0.4 system before the installation of Support Level Supplement (SLS) OSS601A.
Cause
The crontab(C) manual page says: The sixth field is a string that is executed by the shell at the
specified time (using time(S) format). A "%" in this field is
translated into a newline character. Only the first line (up to
a "%" or end-of-line) of the command field is executed by the
shell. The other lines are made available to the command as
standard input.The version of cron(C) in SCO OpenServer 5.0.2 and 5.0.4 did not behave in the fashion described above and was fixed in SLS OSS601A.
Solution
If you want to use date(C) with the +format syntax, SCO recommends that you run date from a shell script and call the shell script from within your crontab file.
A sample shell script called $HOME/date.sh could contain:
#!/bin/sh
date +%d/%m/%yOnce you have created the shell script, you should make it executable using chmod(C) as follows:
chmod +x $HOME/date.shThen save your current crontab entries using:
crontab -l > cron.fileEdit the crontab file and add an entry for your shell script.