<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>[LINICKX].com &#187; howto</title>
	<atom:link href="http://www.linickx.com/tag/howto/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linickx.com</link>
	<description>Moments of Genius followed by Trash.</description>
	<lastBuildDate>Thu, 17 May 2012 10:23:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>RedHat Cluster &#8211; How to Disable Fencing</title>
		<link>http://www.linickx.com/3191/redhat-cluster-how-to-disable-fencing</link>
		<comments>http://www.linickx.com/3191/redhat-cluster-how-to-disable-fencing#comments</comments>
		<pubDate>Tue, 25 Jan 2011 19:37:06 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Enterprise Linux]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[fencing]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[selinux]]></category>

		<guid isPermaLink="false">http://www.linickx.com/?p=3191</guid>
		<description><![CDATA[I&#8217;ve spent far too long googling how to disable fencing&#8230;. I can only guess that because you shouldn&#8217;t really disable fencing no-one wants to post a how to&#8230; so for the hard of hearing. Do NOT disable fencing on your &#8230; <a href="http://www.linickx.com/3191/redhat-cluster-how-to-disable-fencing">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve spent far too long googling how to disable fencing&#8230;. I can only guess that because you shouldn&#8217;t really disable fencing no-one wants to post a how to&#8230; so for the hard of hearing.</p>
<p><strong>Do NOT disable fencing on your RedHat Cluster unless you really know what you&#8217;re doing! Fencing is designed to protect your data from corruption, if you disable fencing your data is at RISK, you have been warned!</strong></p>
<p>I however am working on building a GFS DRBD cluster, as far as I can gather DRBD doesn&#8217;t need fencing, and the bottom line is my data is personal data not mission critical and if my website goes down due to my disabling fencing then it&#8217;s no big deal.</p>
<p>Rant over, here we go&#8230;.. To disable fencing, create a custom fence agent.</p>
<p>Fence agents are simply scripts in /sbin, I&#8217;ve created /sbin/myfence and here are the contents.</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
echo &quot;success: myfence $2&quot;
exit 0
</pre>
<p>Next, change your cluster.conf&#8230;</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;cluster alias=&quot;linickx&quot; config_version=&quot;41&quot; name=&quot;linickx&quot;&gt;
        &lt;cman expected_votes=&quot;1&quot; two_node=&quot;1&quot; /&gt;

        &lt;clusternodes&gt;
                &lt;clusternode name=&quot;CentOS1&quot; nodeid=&quot;1&quot; votes=&quot;1&quot;&gt;
                         &lt;fence&gt;
                                &lt;method name=&quot;1&quot;&gt;
                                        &lt;device nodename=&quot;CentOS1&quot; name=&quot;myfence&quot;/&gt;
                                &lt;/method&gt;
                        &lt;/fence&gt;
                &lt;/clusternode&gt;

                &lt;clusternode name=&quot;CentOS2&quot; nodeid=&quot;2&quot; votes=&quot;1&quot;&gt;
                        &lt;fence&gt;
                                &lt;method name=&quot;2&quot;&gt;
                                        &lt;device nodename=&quot;CentOS2&quot; name=&quot;myfence&quot;/&gt;
                                &lt;/method&gt;
                        &lt;/fence&gt;
                &lt;/clusternode&gt;
        &lt;/clusternodes&gt;

        &lt;fencedevices&gt;
                &lt;fencedevice agent=&quot;myfence&quot; name=&quot;myfence&quot;/&gt;
        &lt;/fencedevices&gt;
        &lt;rm/&gt;
&lt;/cluster&gt;
</pre>
<p>If you&#8217;re running SELINUX don&#8217;t forget to update that! &#8230; start with <code>restorecon /sbin/myfence</code>  then update your policy.</p>
<p>This is the policy I&#8217;ve created&#8230;</p>
<pre class="brush: plain; title: ; notranslate">
module fenced 1.0;

require {
        type fenced_t;
        type shell_exec_t;
        class file { read execute };
}

#============= fenced_t ==============
allow fenced_t shell_exec_t:file { read execute };
</pre>
<p>If you save the above as fenced.te, then run this to install it..</p>
<pre class="brush: plain; title: ; notranslate">
checkmodule -M -m -o fenced.mod fenced.te
semodule_package -o fenced.pp -m fenced.mod
semodule -i fenced.pp
</pre>
<p>You should now be able to start cman, fencing will start but will return success for any fencing issues without actually doing anything!</p>
<p>Happy non-fencing!</p>
<img src="http://www.linickx.com/wp/wp-content/themes/linickx_v2/images/nick_sig_bggrey.png" alt="Nick" /> <hr/>Copyright &copy; 2012 <strong><a href="http://www.linickx.com">[LINICKX].com</a></strong>. This Feed is for personal non-commercial use only. Please check my <a href="http://www.linickx.com/?page_id=63">Site Terms and Conditions</a> for full details on copyrights. If you have any concerns with the content of this feed you may <a href="http://www.linickx.com/contact">contact me here</a>.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">WP Copyright Plugin</a></span>]]></content:encoded>
			<wfw:commentRss>http://www.linickx.com/3191/redhat-cluster-how-to-disable-fencing/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>root-cookie &#8211; Tutorial 1: Accessing WordPress cookies from custom scripts.</title>
		<link>http://www.linickx.com/1016/root-cookie-tutorial-1-accessing-wordpress-cookies-from-custom-scripts</link>
		<comments>http://www.linickx.com/1016/root-cookie-tutorial-1-accessing-wordpress-cookies-from-custom-scripts#comments</comments>
		<pubDate>Fri, 08 May 2009 07:08:10 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[root-cookie]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.linickx.com/?p=1016</guid>
		<description><![CDATA[I&#8217;ve been wanting to do this for a while, this is the 1st in a planned short series of tutorials for my root cookie WordPress plugin. I&#8217;ve decided to start with the purpose I wrote the plugin, then I&#8217;ll move &#8230; <a href="http://www.linickx.com/1016/root-cookie-tutorial-1-accessing-wordpress-cookies-from-custom-scripts">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been wanting to do this for a while, this is the 1st in a planned short series of tutorials for <a href="http://wordpress.org/extend/plugins/root-cookie/">my root cookie WordPress plugin</a>.</p>
<p>I&#8217;ve decided to start with the purpose I wrote the plugin, then I&#8217;ll move onto a couple of tutorial which answer some of the FAQs I get.</p>
<p><strong>Scenario.</strong><br />
Before you start you need a working copy BLANK of WordPress, in a sub directory, with a url like domain.com/wordpress.<br />
A BLANK copy is a fresh install, using the default theme and only my root-cookie plugin installed, remember after activating the plugin clear your browsers cookies.</p>
<p><strong>Getting Started.</strong><br />
So you have a ready &#038; waiting copy of WP, next create a directory called &#8220;my-scripts&#8221; or whatever you like, and in it create 1.php with the following contents:</p>
<p><code><br />
&lt;?php<br />
print_r($_COOKIE);<br />
?&gt;<br />
</code></p>
<p>Browse to domain.com/my-scripts/1.php and you&#8217;ll get a blank white page with <code>Array()</code>.<br />
Next log into WordPress, and re-fresh 1.php and you should get something like&#8230;.</p>
<blockquote><p>
Array ( [wordpress_xxxxxxxxxxxxxyyyyyyyyyyyyyy] => admin|1241455565|xxxxxxxxxxxxxyyyyyyyyyyyyyy [wordpress_logged_in_xxxxxxxxxxxxxyyyyyyyyyyyyyy] => admin|1241455565|xxxxxxxxxxxxxyyyyyyyyyyyyyy )
</p></blockquote>
<p>Done! You&#8217;ve just accessed WordPress&#8217;s cookies <img src='http://www.linickx.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Now when I first started I had a very basic script which hid my Google adverts when I&#8217;m logged in, it&#8217;s against Google&#8217;s policies to click on your own adverts so to avoid accidents I wanted to hide them. </p>
<p>The following script is NOT secure, it doesn&#8217;t check that you&#8217;ve logged into WordPress it simply checks that you a cookie set with the right username (<em>which anyone can fake</em>) but for my purpose this was fine, I had no issues with users faking cookies to get rid of the adverts*</p>
<p><code><br />
&lt;?php<br />
if (isset($_COOKIE["wordpress_logged_in_fxxxxxxxxxxxxxyyyyyyyyyyyyyy"])) {<br />
        $cookie = $_COOKIE["wordpress_logged_in_xxxxxxxxxxxxxyyyyyyyyyyyyyy"];<br />
        $cookie_elements = explode('|', $cookie);<br />
        if ($cookie_elements[0] == "admin") {<br />
                echo "&lt;h1&gt;Hello admin!< &lt;/h1&gt;";<br />
        }<br />
}<br />
?&gt;<br />
</code></p>
<p>Replace admin with whatever username your using and job done! Next time Accessing two WordPress installs domain.com/blog1 domain.com/blog2 with root-cookie <img src='http://www.linickx.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>*<em>this will not work now, as I do something different.</em> <img src='http://www.linickx.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p></code></p>
<img src="http://www.linickx.com/wp/wp-content/themes/linickx_v2/images/nick_sig_bggrey.png" alt="Nick" /> <hr/>Copyright &copy; 2012 <strong><a href="http://www.linickx.com">[LINICKX].com</a></strong>. This Feed is for personal non-commercial use only. Please check my <a href="http://www.linickx.com/?page_id=63">Site Terms and Conditions</a> for full details on copyrights. If you have any concerns with the content of this feed you may <a href="http://www.linickx.com/contact">contact me here</a>.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">WP Copyright Plugin</a></span>]]></content:encoded>
			<wfw:commentRss>http://www.linickx.com/1016/root-cookie-tutorial-1-accessing-wordpress-cookies-from-custom-scripts/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to replace Vitsa&#8217;s Defrag with JkDefrag</title>
		<link>http://www.linickx.com/952/how-to-replace-vitsas-defrag-with-jkdefrag</link>
		<comments>http://www.linickx.com/952/how-to-replace-vitsas-defrag-with-jkdefrag#comments</comments>
		<pubDate>Sat, 25 Apr 2009 10:17:18 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Vista]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.linickx.com/?p=952</guid>
		<description><![CDATA[My work laptop is a Vista machine, a random conversation came up the day about fragmenting (Defraging) the hard drive; since switching to linux at home &#8220;pc maintenance&#8221; hasn&#8217;t really been on my mind, I know that vista does &#8220;stuff&#8221; &#8230; <a href="http://www.linickx.com/952/how-to-replace-vitsas-defrag-with-jkdefrag">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>My work laptop is a Vista machine, a random conversation came up the day about fragmenting (<em>Defraging</em>) the hard drive; since switching to linux at home &#8220;pc maintenance&#8221; hasn&#8217;t really been on my mind, I know that vista does &#8220;stuff&#8221; in the background and internal IT install a heap of &#8220;stuff&#8221; that runs in the background that generally slows things down.</p>
<p>The guys in the office recommended that I should run <a href="http://www.kessels.com/JkDefrag/index.html">JKDefrag</a> to help &#8220;optimize&#8221; things. I downloaded a copy, and read that you have a variety of options to run the software including a screen-saver; my laptop is on pretty much most of the time so I&#8217;ve decided that I would run JkDefrag as a scheduled task over night.</p>
<p>I&#8217;ve not scheduled anything on Vista before and in my investigation I found that vista by default at 1am every wednesday defrags the hard drive! <img src='http://www.linickx.com/wp/wp-includes/images/smilies/icon_cool.gif' alt=':cool:' class='wp-smiley' /> </p>
<p>This changed my plan, instead of scheduling JkDefrag to run, I would replace the default defrag task.</p>
<p>If you would like to do the same, download a copy of JkDefrag and unzip it into a directory, take a note of where you unzip the files as you&#8217;ll need the directory path later.</p>
<p>To get started open the <a href="http://technet.microsoft.com/en-us/appcompat/aa906020.aspx">vista task scheduler</a> (<em>it&#8217;s in admin tools</em>). From the tree in the left browse to:</p>
<p><code><strong>Task Scheduler Library -> Microsoft -> Windows -> Defrag</strong></code></p>
<p>Next download the XML file attached to this post (<em><a href='http://www.linickx.com/files/2009/04/nicksscheduleddefrag.xml'>Nicks Scheduled Defrag</a></em>) and within the Task scheduler, click on &#8220;Import Task&#8221; from the action bar on the right hand side&#8230; browse to and choose my file, once done right click the old &#8220;Scheduled Defrag&#8221; task and disable it, you should end up looking at a window like this&#8230;</p>
<p><a href="http://www.linickx.com/files/2009/04/vista-task-scheduler.png" rel="lightbox[952]"><img src="http://www.linickx.com/files/2009/04/vista-task-scheduler-300x208.png" alt="Vista Task Scheduler" title="Vista Task Scheduler" width="300" height="208" class="aligncenter size-medium wp-image-954" /></a>  </p>
<p>Cool! You&#8217;re nearly there, the task you&#8217;ve installed is a copy of the default defrag task, with the date and action changed to suit my need, <strong>you will need to do the same</strong>! You remember you wrote down a directory path earlier, well you need it now&#8230;.</p>
<p>My scheduled task runs Jkdefrag from a directory called <code>C:\Users\nick.bettison\Software\JkDefrag-3.36\</code>, I&#8217;m 99% sure you won&#8217;t have that directory <img src='http://www.linickx.com/wp/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Right click on <code>NicksScheduledDefrag</code> and select properties , click the actions tab, select &#8220;<code>start a program</code>&#8221; and click edit. Change the path <code>C:\Users\nick.bettison\Software</code> to where ever you have your JkDefrag, you will need to make changes in both the &#8220;Program / Script&#8221; field, and &#8220;Add arguments field&#8221;&#8230;</p>
<p><a href="http://www.linickx.com/files/2009/04/edit-vista-task.png" rel="lightbox[952]"><img src="http://www.linickx.com/files/2009/04/edit-vista-task-300x258.png" alt="Edit Vista Task" title="Edit Vista Task" width="300" height="258" class="aligncenter size-medium wp-image-955" /></a></p>
<p>When done, click Ok. If you feel like it you can change when it runs under the &#8220;triggers&#8221; tab, edit the &#8220;weekly&#8221; trigger to suit your needs.</p>
<p>You can now choose to wait (<em>until 1am saturday night &#8211; or whatever you changed it to</em>), or click run; either way after the task has run in your JkDefrag-3.36 directory you will hopefully have log.txt showing the results of the defrag! <img src='http://www.linickx.com/wp/wp-includes/images/smilies/icon_cool.gif' alt=':cool:' class='wp-smiley' /> </p>
<img src="http://www.linickx.com/wp/wp-content/themes/linickx_v2/images/nick_sig_bggrey.png" alt="Nick" /> <hr/>Copyright &copy; 2012 <strong><a href="http://www.linickx.com">[LINICKX].com</a></strong>. This Feed is for personal non-commercial use only. Please check my <a href="http://www.linickx.com/?page_id=63">Site Terms and Conditions</a> for full details on copyrights. If you have any concerns with the content of this feed you may <a href="http://www.linickx.com/contact">contact me here</a>.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">WP Copyright Plugin</a></span>]]></content:encoded>
			<wfw:commentRss>http://www.linickx.com/952/how-to-replace-vitsas-defrag-with-jkdefrag/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

