Wordpress 4.4.2 | CiviCRM 4.7.1

One thing I noticed about CiviCRM cron and one question...

Observation: Cron won't run if there are some escape characters randomly generated by Wordpress.

I was getting this in my cron daemon emails:

/bin/sh: W_!1IUHzMR: command not found
ERROR: Invalid username and/or password

I changed my password to something less random and it now works. This might frustrate some users who are using Wordpress's own random generator. I didn't see anything about it in the CiviCRM cron installation documentation, so it frustrated me for a while.

My question: I'd like to do log my cron task like this:

*/15 * * * * /usr/local/bin/php /home/me/public_html/wp-content/plugins/civicrm/civicrm/bin/cli.php -s mydomain.org -u me -p myrandompassword -e Job -a execute >> /home/me/cronlog/mydomain.log 2>&1

to log my errors instead of emailing them, but cron refuses to install:

/usr/bin/crontab: installing new crontab
"/tmp/crontab.XXXXax8Prq":3: bad minute
errors in crontab file, can't install.
Do you want to retry the same edit? n
/usr/bin/crontab: edits left in /tmp/crontab.XXXXax8Prq

Is there a way around this?


The Wordpress random password generator seems to create passwords that contain characters that have a special meaning in linux/unix. If you use that in a cron command it will be interpreted by linux based on that meaning in stead of seeing it as a password.

I think your solution is the most clean, make sure the password does not contain the special characters. If for some reason that is not possible you should try "escaping" the special characters. More information at https://serverfault.com/questions/413582/how-to-escape-in-password/413583

Hmm, there seems not that much wrong with your cron command. (except the password should start immediately after the -p, without a space).

The following I could find about your error message: https://www.dougv.com/2006/12/fixing-a-bad-minute-error-message-when-trying-to-use-crontab-with-certain-unix-text-editors/

This problem most often occurs because you’re using a text editor, such as pico, that fakes word wrapping by adding a newline when it reaches a certain column position.

Crontab delimits jobs with line breaks (newlines). Each job occupies one line. Therefore, if crontab sees anything other than an integer in the first column of a line, it throws the “bad minute” error, since the minute argument is the first one crontab encounters.

Could that be the cause?

  • Thank you for your reply. I'm using nano, which is based on pico, I think, so it's probably prone to the word-wrap thing you're talking about, but I suspect that's not the problem because about half an hour later, it suddenly started working after the password was edited. Still can't get it to log though. – Chris Feb 10 '16 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.