Cron job fails on - unexpected EOF while looking for matching `''

HI - First post, looking for some help/suggestions on the following problem.

CRON job that runs on the first of each month, this month (Feb 2020) the job failed with following error:
/bin/sh: -c: line 0: unexpected EOF while looking for matching `’’
/bin/sh: -c: line 1: syntax error: unexpected end of file

I have not changed the CRON job in quite a while. I have an old note/reminder to myself that says that
"Cron jobs on dreamhost are limited to 1000 characters - if over job fails with the above error. My CRON job is only 543 characters.

Have an open “Ticket” with dreamhost but no response yet (1day 4hrs).
Thanks Bill D.

You might try test-running your cron job by editing it to run a few minutes in the future. That can help determine if it is a persistent problem or a one-time hiccup. If the problem is persistent, you could post the job here to see if anyone can spot a problem (be sure to redact any sensitive info).

I’ve certainly seen cron jobs get disabled/deleted during major server changes, like this summer’s OS upgrades, or during server migrations. I keep backups of my cron jobs to aid recovery. If you have backups, you might compare against the current crontab to see if anything has changed.

Cron Jobs created from the DH Panel are passed to sh with single-quotes escaped. For example, the command echo 'hello world' would be turned into:

sh -c 'echo '\''hello world'\'

If one of the quotes is missing, then an unexpected EOF error is generated:

sh -c 'echo '\'hello world'\'
# Fails with: unexpected EOF while looking for matching `''

I have received an email from dreamhost that indicates the problem is on their system(s).

This is the email:

I’m sorry for the continued difficulties you have been encountering with
your monthly cron jobs, Bill! Unfortunately it looks like this is an
issue with some of the security updates we had to make to the way that we
handle the translation of shell commands as the leave the panel and are
inserted into our system (the way cron jobs are) not behaving as

Our developers are still investigating this situation and do not have an
estimate on when this feature will be fully functional again. However
they do have a work around! If you’d like these cron jobs to work again
as quickly as possible, you will need to convert their commands into
scripts under your ‘dwyne’ user and then update the cron jobs to execute
those scripts. Additionally, if you would like to be notified when our
developers have finished investigating this situation, just reply to this
email and we’ll hold on to the support ticket that your reply creates.

Hopefully this all makes sense but if you have any additional questions,
please do not hesitate to contact us again and we’ll do our best to help
you further!

I’ve spent quite a bit of time trying to implement their suggestions re convert to scripts with little success so far. Will be trying again as time permits.

Thanks Bill D.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.