<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Setup Tips</title><link href="http://www.setuptips.com/" rel="alternate"></link><link href="http://feeds.feedburner.com/SetupTips" rel="self"></link><id>http://www.setuptips.com/</id><updated>2013-08-03T01:55:00+10:00</updated><entry><title>Setup Wordpress Multisite Cron</title><link href="http://www.setuptips.com/websites/setup-wordpress-multisite-cron/" rel="alternate"></link><published>2013-08-03T01:55:00+10:00</published><author><name>setuptips</name></author><id>tag:www.setuptips.com,2013-08-03:websites/setup-wordpress-multisite-cron/</id><summary type="html">&lt;p&gt;&lt;img alt="Wordpress Multisite Cron" src="http://www.setuptips.com/images/2013/08/wordpress-multisite-cron.png" title="Wordpress Multisite Cron" /&gt;  &lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;I run a multisite wordpress installation, and I have been a bit
concerned about the amount of load caused by the inbuilt cron managed by
wordpress. Given I have a three node cluster, I also only wanted one
node to be running&amp;nbsp;cron.&lt;/p&gt;
&lt;p&gt;Yoast had good things to say about the &lt;a href="http://wordpress.org/plugins/wp-cron-control"&gt;&lt;span class="caps"&gt;WP&lt;/span&gt; cron control plugin&lt;/a&gt; &lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="http://www.setuptips.com#fn:1" rel="footnote"&gt;1&lt;/a&gt;&lt;/sup&gt;. 
Unfortunately, this plugin is all well and good for normal wordpress
sites but will not work for multisite installations. For multisite
installations you will need to call the cron job for every domain you
host. This is very tedious and prone to error if you host lots of&amp;nbsp;domains.&lt;/p&gt;
&lt;p&gt;I found a workable solution &lt;sup id="fnref:2"&gt;&lt;a class="footnote-ref" href="http://www.setuptips.com#fn:2" rel="footnote"&gt;2&lt;/a&gt;&lt;/sup&gt; for multi sites using the wp-cron
control plugin and another plugin called &lt;em&gt;wp-multisite-cron&lt;/em&gt; that
iterates through the domains nicely calling cron for each of them. It&amp;#8217;s
not an official wordpress plugin &lt;sup id="fnref:3"&gt;&lt;a class="footnote-ref" href="http://www.setuptips.com#fn:3" rel="footnote"&gt;3&lt;/a&gt;&lt;/sup&gt; but the code looks good and is
hosted on&amp;nbsp;github.&lt;/p&gt;
&lt;p&gt;The steps&amp;nbsp;are&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Download the wp-cron-control plugin and network activate&amp;nbsp;it&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Download the wp-multisite-cron  plugin and network activate&amp;nbsp;it&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add the following lines to &lt;em&gt;wp-config.php&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;define(&amp;#39;DISABLE_WP_CRON&amp;#39;, true);  
define(&amp;#39;WP_CRON_CONTROL_SECRET&amp;#39;, your-secret-key-goes-here);
&lt;/pre&gt;&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;I had to edit &lt;em&gt;wp_multisite_cron.php&lt;/em&gt; to include the secret key.
    Just edit line&amp;nbsp;194  &lt;/li&gt;
&lt;/ul&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="p"&gt;$&lt;/span&gt;&lt;span class="nv"&gt;cron_url&lt;/span&gt;&lt;span class="x"&gt; = site_url().&amp;#39;/wp-cron.php?doing_wp_cron&amp;amp;&amp;#39;.WP_CRON_CONTROL_SECRET;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Add a crontab entry on your master&amp;nbsp;server. &lt;/li&gt;
&lt;/ul&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;* */15 * * * *
/usr/bin/wget -q -O /tmp/test.html  http://yourdomain/wp-admin/admin-ajax.php?action=wp_multisite_cron_call
&lt;/pre&gt;&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;If you have a multi-node cluster make sure your crontab entry only
    goes on the master server. Also, if you use round-robin &lt;span class="caps"&gt;DNS&lt;/span&gt; ensure
    that the &lt;em&gt;/etc/hosts&lt;/em&gt; file on the master servers includes only the
    &lt;span class="caps"&gt;IP&lt;/span&gt; address of only the master server for the  &lt;em&gt;yourdomain&lt;/em&gt; entry,
    where &lt;em&gt;yourdomain&lt;/em&gt; is the main domain of your multi-site wordpress
    intallation.&lt;em&gt; &lt;/em&gt;This ensures that the wget call will always be made
    to your master server and not the other nodes in your&amp;nbsp;cluster.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Under &lt;em&gt;Settings-&gt;&lt;span class="caps"&gt;WP&lt;/span&gt; multisite cron&lt;/em&gt;, I set &lt;em&gt;Concurrent crons&lt;/em&gt; to 5.
    The default setting is way too&amp;nbsp;high.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Gotchas&lt;/h3&gt;
&lt;p&gt;If you get the following error messages when calling the multisite cron&amp;nbsp;command&lt;/p&gt;
&lt;p&gt;&lt;em&gt;another cron process running or previous not older than 60&amp;nbsp;secs&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;then you probably forgot to add &lt;em&gt;define(&amp;#8216;DISABLE_WP_CRON&amp;#8217;, true);&lt;/em&gt; to&amp;nbsp;wp-config.php&lt;/p&gt;
&lt;div class="footnote"&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;&lt;a href="http://yoast.com/review/wp-cron-control/"&gt;&lt;span class="caps"&gt;WP&lt;/span&gt; Cron Review By Yoast&lt;/a&gt;&amp;#160;&lt;a class="footnote-backref" href="http://www.setuptips.com#fnref:1" rev="footnote" title="Jump back to footnote 1 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:2"&gt;
&lt;p&gt;&lt;a href="http://espiti.com/webdev/2012/02/10/wp-cron-control-for-multisite/"&gt;wp-cron Control For Multisite&lt;/a&gt;&amp;#160;&lt;a class="footnote-backref" href="http://www.setuptips.com#fnref:2" rev="footnote" title="Jump back to footnote 2 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:3"&gt;
&lt;p&gt;&lt;a href="https://github.com/chibani/wp_multisite_cron"&gt;wp-multisite-cron&lt;/a&gt;&amp;#160;&lt;a class="footnote-backref" href="http://www.setuptips.com#fnref:3" rev="footnote" title="Jump back to footnote 3 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</summary><category term="WPMU"></category></entry><entry><title>Screen Error | Cannot Open Your Terminal</title><link href="http://www.setuptips.com/unix/screen-cannot-open-your-termina/" rel="alternate"></link><published>2013-05-14T19:28:00+10:00</published><author><name>setuptips</name></author><id>tag:www.setuptips.com,2013-05-14:unix/screen-cannot-open-your-termina/</id><summary type="html">&lt;p&gt;&lt;img alt="gnu-screen" src="http://www.setuptips.com/images/2013/05/gnu-screen.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;A user had the following problem when trying to re-open a previous
&lt;a href="http://en.wikipedia.org/wiki/GNU_Screen"&gt;screen&lt;/a&gt; session they had initiated and then detached&amp;nbsp;from.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;user@host: screen -r 8814.pts-0.host  
Cannot open your terminal &amp;#39;/dev/pts/41&amp;#39; - please check.  
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;After some research there were two suggestions. One solution suggested
changing the permissions of /dev/pts/41 - clearly a very bad&amp;nbsp;idea.&lt;/p&gt;
&lt;p&gt;The solution that worked was to run &lt;em&gt;script /dev/null&lt;/em&gt;&amp;nbsp;first.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;user@host: script /dev/null  
Script started, file is /dev/null

user@host: screen -ls  
There is a screen on:  
8814.pts-0.host (Detached)

user@host: screen -r 8814.pts-0.host  
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The user had probably ran a &lt;em&gt;sudosu&lt;/em&gt; to&amp;nbsp;themselves.&lt;/p&gt;
&lt;p&gt;Reference:&amp;nbsp;http://serverfault.com/questions/116775/sudo-as-different-user-and-running-screen/116830#116830&lt;/p&gt;</summary><category term="Unix"></category></entry><entry><title>Most Useful Chrome Extensions</title><link href="http://www.setuptips.com/software/most-useful-chrome-extensions/" rel="alternate"></link><published>2013-04-26T01:11:00+10:00</published><author><name>setuptips</name></author><id>tag:www.setuptips.com,2013-04-26:software/most-useful-chrome-extensions/</id><summary type="html">&lt;p&gt;&lt;img alt="Chrome Extensions" src="http://www.setuptips.com/images/2013/04/2848385446_21fe33dfd2.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="http://www.setuptips.com#fn:1" rel="footnote"&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;p&gt;These are the Chrome extensions that I find most useful for increasing
my productivity at my&amp;nbsp;desktop.&lt;/p&gt;
&lt;h2&gt;Buffer&lt;/h2&gt;
&lt;p&gt;Buffer is the best way to share great content to Twitter, Facebook and
LinkedIn from anywhere on the web, with just one&amp;nbsp;click.&lt;/p&gt;
&lt;h2&gt;Clearly&lt;/h2&gt;
&lt;p&gt;Clearly makes blog posts, articles and webpages clean and easy to read.
Save them to Evernote to read anywhere. You can also create
advertisement free &lt;span class="caps"&gt;PDF&lt;/span&gt; print&lt;br /&gt;
outs of blog posts. There is also a text to speech translator built in,
but it only works for relatively small&amp;nbsp;documents.&lt;/p&gt;
&lt;h2&gt;Evernote Web&amp;nbsp;Clipper&lt;/h2&gt;
&lt;p&gt;Use the Evernote extension to save things you see on the web into your
Evernote account. It even lets you search through your notes.
Permissions Visit&amp;nbsp;website&lt;/p&gt;
&lt;h2&gt;Feedly - Your News, &lt;span class="caps"&gt;RSS&lt;/span&gt;, Google&amp;nbsp;Reader&lt;/h2&gt;
&lt;p&gt;Feedly is a news reader for creative minds. Seamless migration from
Google Reader. This is my indended replacement for Googe&amp;nbsp;Reader.&lt;/p&gt;
&lt;h2&gt;HootSuite&amp;nbsp;Hootlet&lt;/h2&gt;
&lt;p&gt;Quickly share web pages to all of your social networks using the
HootSuite&amp;nbsp;Hootlet.&lt;/p&gt;
&lt;h2&gt;LastPass&lt;/h2&gt;
&lt;p&gt;LastPass is a free password manager and form filler. LastPass is also
available for Firefox, Internet Explorer, Opera and Safari. Permissions
Visit&amp;nbsp;website&lt;/p&gt;
&lt;h2&gt;Pocket (formerly Read It&amp;nbsp;Later)&lt;/h2&gt;
&lt;p&gt;Pocket Extension for Google Chrome - The best way to save articles,
videos and&amp;nbsp;more&lt;/p&gt;
&lt;h2&gt;ScribeFire&lt;/h2&gt;
&lt;p&gt;An easy-to-use blog editor lets you post to all of your&amp;nbsp;blogs.&lt;/p&gt;
&lt;h2&gt;Weather&lt;/h2&gt;
&lt;p&gt;This application geolocates you and displays in one click your favorite
location. Its great for Ubuntu desktops where there is no currently
functioning weather application&amp;nbsp;available.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Sending and reading web content such as news articles and blog posts to
your Kindle device. This works well in conjunction with Clearly. I use
Clearly to get rid of all the ads and then forward the cleaned page to
my&amp;nbsp;Kindle.&lt;/p&gt;
&lt;div class="footnote"&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;Image Attribution &lt;a href="http://www.flickr.com/photos/gudmundurbjarni/2848385446/"&gt;Gumundur Bjarni Alafsson&lt;/a&gt;&amp;#160;&lt;a class="footnote-backref" href="http://www.setuptips.com#fnref:1" rev="footnote" title="Jump back to footnote 1 in the text"&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</summary><category term="Software"></category></entry></feed>