Answers.Body: <p>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. </p>
  
  <p>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 <a href="https://serverfault.com/questions/413582/how-to-escape-in-password/413583">https://serverfault.com/questions/413582/how-to-escape-in-password/413583</a></p>
  
  <p>Hmm, there seems not that much wrong with your cron command. (except the password should start immediately after the -p, without a space).</p>
  
  <p>The following I could find about your error message: <a href="https://www.dougv.com/2006/12/fixing-a-bad-minute-error-message-when-trying-to-use-crontab-with-certain-unix-text-editors/" rel="nofollow noreferrer">https://www.dougv.com/2006/12/fixing-a-bad-minute-error-message-when-trying-to-use-crontab-with-certain-unix-text-editors/</a></p>
  
  <blockquote>
    <p>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.</p>
    
    <p>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.</p>
  </blockquote>
  
  <p>Could that be the cause?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-10T23:41:38.110Z
Answers.Text: 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.
Answers.UserDisplayName: Chris
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-09T07:15:40.193Z
Answers.LastActivityDate: 2016-02-09T07:15:40.193Z
Answers.LastEditDate: 2017-04-13T12:14:48.540Z
Answers.UserDisplayName: Catorghans
Body: <p>Wordpress  4.4.2 | CiviCRM 4.7.1</p>
  
  <p>One thing I noticed about CiviCRM cron and one question...</p>
  
  <p><strong>Observation:</strong>
  Cron won't run if there are some escape characters randomly generated by Wordpress.</p>
  
  <p>I was getting this in my cron daemon emails:</p>
  
  <pre><code>/bin/sh: W_!1IUHzMR: command not found
  ERROR: Invalid username and/or password
  </code></pre>
  
  <p>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. </p>
  
  <p><strong>My question:</strong> 
  I'd like to do log my cron task like this: </p>
  
  <pre><code>*/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 &gt;&gt; /home/me/cronlog/mydomain.log 2&gt;&amp;1
  </code></pre>
  
  <p>to log my errors instead of emailing them, but cron refuses to install:</p>
  
  <pre><code>/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
  </code></pre>
  
  <p>Is there a way around this?</p>
  
Tags: <cron-job>
Title: Randomly Generated user Passwords, Local Cron Logs and Cron for CiviCRM
ThreadText: # Randomly Generated user Passwords, Local Cron Logs and Cron for CiviCRM
  
  (Asked by: username_0 on 2016-02-09)
  
  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?
  
  **Tags:** cron-job
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-02-09. Score: 1 | Accepted answer
  
  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?
  
  > **Comments:**
  > **username_0**: 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.  
  
  ---
  
  