<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>LINICKX.com</title><link>https://www.linickx.com/</link><description></description><lastBuildDate>Tue, 25 Jan 2011 19:37:00 +0000</lastBuildDate><item><title>RedHat Cluster - How to Disable Fencing</title><link>https://www.linickx.com/redhat-cluster-how-to-disable-fencing</link><description>&lt;p&gt;I've spent far too long googling how to disable fencing.... I can only
guess that because you shouldn't really disable fencing no-one wants to
post a how to... so for the hard of hearing.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Do NOT disable fencing on your RedHat Cluster unless you really know
what you're doing! Fencing is designed to protect your data from
corruption, if you disable fencing your data is at RISK, you have been
warned!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I however am working on building a GFS DRBD cluster, as far as I can
gather DRBD doesn'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's no big deal.&lt;/p&gt;
&lt;p&gt;Rant over, here we go..... To disable fencing, create a custom fence
agent.&lt;/p&gt;
&lt;p&gt;Fence agents are simply scripts in /sbin, I've created /sbin/myfence and
here are the contents.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/bin.bash
echo "success: myfence $2"
exit 0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next, change your cluster.conf...&lt;/p&gt;
&lt;p&gt;If you're running SELINUX don't forget to update that! ... start with
&lt;code&gt;restorecon /sbin/myfence&lt;/code&gt; then update your policy.&lt;/p&gt;
&lt;p&gt;This is the policy I've created...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;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 };
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you save the above as fenced.te, then run this to install it..&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;checkmodule -M -m -o fenced.mod fenced.te
semodule_package -o fenced.pp -m fenced.mod
semodule -i fenced.pp
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You should now be able to start cman, fencing will start but will return
success for any fencing issues without actually doing anything!&lt;/p&gt;
&lt;p&gt;Happy non-fencing!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Tue, 25 Jan 2011 19:37:00 +0000</pubDate><guid isPermaLink="false">tag:www.linickx.com,2011-01-25:redhat-cluster-how-to-disable-fencing</guid><category>centos</category><category>cluster</category><category>fencing</category><category>howto</category><category>redhat</category><category>selinux</category></item><item><title>root-cookie - Tutorial 1: Accessing WordPress cookies from custom scripts.</title><link>https://www.linickx.com/root-cookie-tutorial-1-accessing-wordpress-cookies-from-custom-scripts</link><description>&lt;p&gt;I've been wanting to do this for a while, this is the 1st in a planned
short series of tutorials for &lt;a href="http://wordpress.org/extend/plugins/root-cookie/"&gt;my root cookie WordPress
plugin&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I've decided to start with the purpose I wrote the plugin, then I'll
move onto a couple of tutorial which answer some of the FAQs I get.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Scenario.&lt;/strong&gt;&lt;br /&gt;
Before you start you need a working copy BLANK of WordPress, in a sub
directory, with a url like domain.com/wordpress.&lt;br /&gt;
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.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Getting Started.&lt;/strong&gt;&lt;br /&gt;
So you have a ready &amp;amp; waiting copy of WP, next create a directory
called "my-scripts" or whatever you like, and in it create 1.php with
the following contents:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;?php print_r($_COOKIE); ?&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Browse to domain.com/my-scripts/1.php and you'll get a blank white page
with &lt;code&gt;Array()&lt;/code&gt;.&lt;br /&gt;
Next log into WordPress, and re-fresh 1.php and you should get
something like....&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Array ( [wordpress_xxxxxxxxxxxxxyyyyyyyyyyyyyy] =&amp;gt;
admin|1241455565|xxxxxxxxxxxxxyyyyyyyyyyyyyy
[wordpress_logged_in_xxxxxxxxxxxxxyyyyyyyyyyyyyy] =&amp;gt;
admin|1241455565|xxxxxxxxxxxxxyyyyyyyyyyyyyy )&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Done! You've just accessed WordPress's cookies :)&lt;/p&gt;
&lt;p&gt;Now when I first started I had a very basic script which hid my Google
adverts when I'm logged in, it's against Google's policies to click on
your own adverts so to avoid accidents I wanted to hide them.&lt;/p&gt;
&lt;p&gt;The following script is NOT secure, it doesn't check that you've logged
into WordPress it simply checks that you a cookie set with the right
username (&lt;em&gt;which anyone can fake&lt;/em&gt;) but for my purpose this was fine, I
had no issues with users faking cookies to get rid of the adverts*&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;?php if (isset($_COOKIE["wordpress_logged_in_fxxxxxxxxxxxxxyyyyyyyyyyyyyy"])) {         $cookie = $_COOKIE["wordpress_logged_in_xxxxxxxxxxxxxyyyyyyyyyyyyyy"];         $cookie_elements = explode('|', $cookie);         if ($cookie_elements[0] == "admin") {                 echo "&amp;lt;h1&amp;gt;Hello admin!&amp;lt; &amp;lt;/h1&amp;gt;";         } } ?&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;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 :)&lt;/p&gt;
&lt;p&gt;*&lt;em&gt;this will not work now, as I do something different.&lt;/em&gt; :)&lt;/p&gt;
&lt;p&gt;&lt;/code&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Fri, 08 May 2009 08:08:00 +0100</pubDate><guid isPermaLink="false">tag:www.linickx.com,2009-05-08:root-cookie-tutorial-1-accessing-wordpress-cookies-from-custom-scripts</guid><category>howto</category><category>root-cookie</category><category>tutorial</category><category>WordPress</category></item><item><title>How to replace Vitsa's Defrag with JkDefrag</title><link>https://www.linickx.com/how-to-replace-vitsas-defrag-with-jkdefrag</link><description>&lt;p&gt;My work laptop is a Vista machine, a random conversation came up the day
about fragmenting (&lt;em&gt;Defraging&lt;/em&gt;) the hard drive; since switching to linux
at home "pc maintenance" hasn't really been on my mind, I know that
vista does "stuff" in the background and internal IT install a heap of
"stuff" that runs in the background that generally slows things down.&lt;/p&gt;
&lt;p&gt;The guys in the office recommended that I should run
&lt;a href="http://www.kessels.com/JkDefrag/index.html"&gt;JKDefrag&lt;/a&gt; to help
"optimize" 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've decided that I would run JkDefrag
as a scheduled task over night.&lt;/p&gt;
&lt;p&gt;I'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! :cool:&lt;/p&gt;
&lt;p&gt;This changed my plan, instead of scheduling JkDefrag to run, I would
replace the default defrag task.&lt;/p&gt;
&lt;p&gt;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'll
need the directory path later.&lt;/p&gt;
&lt;p&gt;To get started open the &lt;a href="http://technet.microsoft.com/en-us/appcompat/aa906020.aspx"&gt;vista task
scheduler&lt;/a&gt;
(&lt;em&gt;it's in admin tools&lt;/em&gt;). From the tree in the left browse to:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Task Scheduler Library -&amp;gt; Microsoft -&amp;gt; Windows -&amp;gt; Defrag&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Next download the XML file attached to this post (&lt;em&gt;&lt;a href="https://www.linickx.com/files/2009/04/nicksscheduleddefrag.xml"&gt;Nicks Scheduled
Defrag&lt;/a&gt;&lt;/em&gt;)
and within the Task scheduler, click on "Import Task" from the action
bar on the right hand side... browse to and choose my file, once done
right click the old "Scheduled Defrag" task and disable it, you should
end up looking at a window like this...&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.linickx.com/files/2009/04/vista-task-scheduler.png"&gt;&lt;img alt="Vista Task
Scheduler" src="https://www.linickx.com/files/2009/04/vista-task-scheduler-300x208.png" title="Vista Task Scheduler" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Cool! You're nearly there, the task you've installed is a copy of the
default defrag task, with the date and action changed to suit my need,
&lt;strong&gt;you will need to do the same&lt;/strong&gt;! You remember you wrote down a
directory path earlier, well you need it now....&lt;/p&gt;
&lt;p&gt;My scheduled task runs Jkdefrag from a directory called
&lt;code&gt;C:\Users\nick.bettison\Software\JkDefrag-3.36\&lt;/code&gt;, I'm 99% sure you won't
have that directory ;)&lt;/p&gt;
&lt;p&gt;Right click on &lt;code&gt;NicksScheduledDefrag&lt;/code&gt; and select properties , click the
actions tab, select "&lt;code&gt;start a program&lt;/code&gt;" and click edit. Change the path
&lt;code&gt;C:\Users\nick.bettison\Software&lt;/code&gt; to where ever you have your JkDefrag,
you will need to make changes in both the "Program / Script" field, and
"Add arguments field"...&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.linickx.com/files/2009/04/edit-vista-task.png"&gt;&lt;img alt="Edit Vista
Task" src="https://www.linickx.com/files/2009/04/edit-vista-task-300x258.png" title="Edit Vista Task" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;When done, click Ok. If you feel like it you can change when it runs
under the "triggers" tab, edit the "weekly" trigger to suit your needs.&lt;/p&gt;
&lt;p&gt;You can now choose to wait (&lt;em&gt;until 1am saturday night - or whatever you
changed it to&lt;/em&gt;), 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! :cool:&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Sat, 25 Apr 2009 11:17:00 +0100</pubDate><guid isPermaLink="false">tag:www.linickx.com,2009-04-25:how-to-replace-vitsas-defrag-with-jkdefrag</guid><category>howto</category><category>Vista</category><category>Windows</category></item></channel></rss>