Monday, October 16, 2006

CRON line 1: Unexpected EOF while looking for matching ``'

CRON line 1: Unexpected EOF while looking for matching ``'

When running a CRON job that uses the command:
NOW=`date +%B_%d_%a_%Y`

the script will abort execution and display the following error:

/bin/sh: -c: line 1: unexpected EOF while looking for matching ``'
/bin/sh: -c: line 2: syntax error: unexpected end of file
To prevent this issue from occurring, dump the contents of the script into a .sh file and run the .sh from CRON.

Sometimes, CRON is set to use sh as opposed to the bash shell that the script needs.

The CRON shell can be modified in the /etc/crontab config file. Requires r00t privileges. Ensure that the CRON daemon is restarted after the modifications.

/sbin/service crond restart

No comments: