<?xml version="1.0"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>CRIN Trac: Ticket #18: Drush</title>
    <link>https://trac.crin.org/trac/ticket/18</link>
    <description>&lt;p&gt;
Drush doesn't work on &lt;a class="wiki" href="https://trac.crin.org/trac/wiki/Crin2"&gt;Crin2&lt;/a&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;su - www-data -s /bin/bash
drush pm-updatestatus
Command pm-updatestatus needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal        [error]
environment to run this command.
The drush command 'pm-updatestatus' could not be executed.                                                                         [error]
Drush was not able to start (bootstrap) the Drupal database.                                                                       [error]
Hint: This may occur when Drush is trying to:
 * bootstrap a site that has not been installed or does not have a configured database. In this case you can select another site
with a working database setup by specifying the URI to use with the --uri parameter on the command line. See `drush topic
docs-aliases` for details.
 * connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed shell.
See http://drupal.org/node/1428638 for details.
Drush was attempting to connect to:
 Drupal version         :  7.24
 Site URI               :  http://crin1.crin.org/
 Database driver        :  mysql
 Database hostname      :  crin1
 Database port          :
 Database username      :  drupal
 Database name          :  drupal
 PHP executable         :  /usr/bin/php
 PHP configuration      :  /etc/php5/cli/php.ini
 PHP OS                 :  Linux
 Drush script           :  /usr/local/src/drush-master/drush.php
 Drush version          :  7.0-dev
 Drush temp directory   :  /tmp
 Drush configuration    :  /var/www/.drush/drushrc.php
 Drush alias files      :
 Drupal root            :  /var/www/drupal
 Site path              :  sites/default
&lt;/pre&gt;</description>
    <language>en-us</language>
    <image>
      <title>CRIN Trac</title>
      <url>https://trac.crin.org/trac/chrome/site/logo.gif</url>
      <link>https://trac.crin.org/trac/ticket/18</link>
    </image>
    <generator>Trac 1.0.2</generator>
    <item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Fri, 12 Jun 2015 16:49:34 GMT</pubDate>
      <title>hours changed; totalhours set</title>
      <link>https://trac.crin.org/trac/ticket/18#comment:1</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/18#comment:1</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.15&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                set to &lt;em&gt;0.15&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Here is the error:
&lt;/p&gt;
&lt;pre class="wiki"&gt;su - www-data -s /bin/bash
/usr/local/bin/drush --root=/var/www/drupal --uri=www.crin.org -dv pm-updatestatus
...
  ERROR 1045 (28000): Access denied for user 'drupal'@'crin2' (using password: YES)
...
&lt;/pre&gt;&lt;p&gt;
And this is a open issue on Github:
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a class="ext-link" href="https://github.com/drush-ops/drush/issues/965"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;https://github.com/drush-ops/drush/issues/965&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
So I think the Drupal cron job will need to be set up to use &lt;tt&gt;wget&lt;/tt&gt; rather than &lt;tt&gt;drush&lt;/tt&gt;, see: &lt;a class="closed ticket" href="https://trac.crin.org/trac/ticket/6#comment:29" title="task: Migrate Drupal site from GreenQloud (closed: fixed)"&gt;ticket:6#comment:29&lt;/a&gt;
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Sat, 13 Jun 2015 11:44:26 GMT</pubDate>
      <title>hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/18#comment:2</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/18#comment:2</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.2&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;0.15&lt;/em&gt; to &lt;em&gt;0.35&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Looking at setting up the Drupal cronjob, first get a one time login:
&lt;/p&gt;
&lt;pre class="wiki"&gt;sudo -i
su - www-data -s /bin/bash
cd drupal/
drush uli
&lt;/pre&gt;&lt;p&gt;
Following &lt;a class="ext-link" href="https://www.drupal.org/cron"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;this documentation&lt;/a&gt; it turns out that the site is set to use "poor mans cron" every 3 hours, see &lt;a class="ext-link" href="https://www.crin.org/en/admin/config/system/cron"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;the cron config page&lt;/a&gt;, so the &lt;tt&gt;www-data&lt;/tt&gt; crontab was commented out.
&lt;/p&gt;
&lt;p&gt;
I'm leaving this ticket open as the web developers might need to have &lt;tt&gt;drush&lt;/tt&gt; available for SQl commands and &lt;a class="ext-link" href="https://www.stunnel.org/"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;stunnel&lt;/a&gt; or a SSH tunnel was used for the MySQL traffic then &lt;tt&gt;drush&lt;/tt&gt; would fully work.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Mon, 06 Jul 2015 16:53:18 GMT</pubDate>
      <title>cc, hours, totalhours changed</title>
      <link>https://trac.crin.org/trac/ticket/18#comment:3</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/18#comment:3</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;cc&lt;/strong&gt;
              &lt;em&gt;peter&lt;/em&gt; added
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.05&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;0.35&lt;/em&gt; to &lt;em&gt;0.4&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Peter has been added to this ticket. See also &lt;a class="closed ticket" href="https://trac.crin.org/trac/ticket/27" title="defect: Crin2 certificate access (closed: fixed)"&gt;ticket:27&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Replying to &lt;a class="ticket" href="https://trac.crin.org/trac/ticket/18#comment:2" title="Comment 2"&gt;chris&lt;/a&gt;:
&lt;/p&gt;
&lt;blockquote class="citation"&gt;
&lt;p&gt;
I'm leaving this ticket open as the web developers might need to have &lt;tt&gt;drush&lt;/tt&gt; available for SQl commands and &lt;a class="ext-link" href="https://www.stunnel.org/"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;stunnel&lt;/a&gt; or a SSH tunnel was used for the MySQL traffic then &lt;tt&gt;drush&lt;/tt&gt; would fully work
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
Drush running SQL commands does appear to work as &lt;tt&gt;root&lt;/tt&gt;:
&lt;/p&gt;
&lt;pre class="wiki"&gt;sudo -i
cd /var/www/drupal
drush sqlq "show tables"
  actions
  ...
&lt;/pre&gt;&lt;p&gt;
But not as another user:
&lt;/p&gt;
&lt;pre class="wiki"&gt;sudo -i
su - www-data -s /bin/bash
cd /var/www/drupal
drush sqlq "show tables"
  Query failed.                [error]
&lt;/pre&gt;&lt;p&gt;
Peter -- any better idea than simply doing everything as &lt;tt&gt;root&lt;/tt&gt; (this might not be the worst idea...)?
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>chris</dc:creator>

      <pubDate>Mon, 06 Jul 2015 17:14:54 GMT</pubDate>
      <title>hours, status, totalhours changed; resolution set</title>
      <link>https://trac.crin.org/trac/ticket/18#comment:4</link>
      <guid isPermaLink="false">https://trac.crin.org/trac/ticket/18#comment:4</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;hours&lt;/strong&gt;
                changed from &lt;em&gt;0&lt;/em&gt; to &lt;em&gt;0.08&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;status&lt;/strong&gt;
                changed from &lt;em&gt;new&lt;/em&gt; to &lt;em&gt;closed&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;resolution&lt;/strong&gt;
                set to &lt;em&gt;fixed&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;totalhours&lt;/strong&gt;
                changed from &lt;em&gt;0.4&lt;/em&gt; to &lt;em&gt;0.48&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
I have solved this, we simply need to create &lt;tt&gt;~/.my.cnf&lt;/tt&gt; files for every user that uses MySQl on &lt;a class="wiki" href="https://trac.crin.org/trac/wiki/Crin2"&gt;Crin2&lt;/a&gt; containing:
&lt;/p&gt;
&lt;pre class="wiki"&gt;[client]
host=crin1
ssl-cipher=DHE-RSA-AES256-SHA
ssl-ca=/etc/ssl/cacert/cacert.pem
ssl-cert=/etc/ssl/cacert/crin1_cert.pem
ssl-key=/etc/ssl/cacert/crin1_yassl_privatekey.pem
&lt;/pre&gt;&lt;p&gt;
And then Drush works without a problem:
&lt;/p&gt;
&lt;pre class="wiki"&gt;sudo -i
su - www-data -s /bin/bash
cd /var/www/drupal
drush sqlq "show tables" | less
  actions
  ...
&lt;/pre&gt;&lt;p&gt;
So closing this ticket, I'll also post a comment to &lt;a class="ext-link" href="https://github.com/drush-ops/drush/issues/965"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;the Drush ticket&lt;/a&gt;.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item>
 </channel>
</rss>