<?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>/proc/sys/net/blog &#187; backup</title>
	<atom:link href="http://momotonic.com/category/backup/feed/" rel="self" type="application/rss+xml" />
	<link>http://momotonic.com</link>
	<description>rants, tutorials and documents about everything server related</description>
	<lastBuildDate>Tue, 14 Jul 2009 15:55:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Migrating cPanel reseller accounts with root WHM access</title>
		<link>http://momotonic.com/2008/12/30/migrating-cpanel-reseller-accounts-with-root-whm-access/</link>
		<comments>http://momotonic.com/2008/12/30/migrating-cpanel-reseller-accounts-with-root-whm-access/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 21:36:38 +0000</pubDate>
		<dc:creator>Mo</dc:creator>
				<category><![CDATA[backup]]></category>
		<category><![CDATA[cpanel]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[migrating]]></category>
		<category><![CDATA[migrating reseller account]]></category>
		<category><![CDATA[reseller]]></category>

		<guid isPermaLink="false">http://momotonic.com/?p=23</guid>
		<description><![CDATA[We have a few clients that were WHM resellers and upgraded to VPS with root cPanel, however there is no main easy way to migrate WHM reseller account to a root account under WHM, that&#8217;s where we started playing around and making our own script.  You need root access to the source and final [...]]]></description>
			<content:encoded><![CDATA[<p>We have a few clients that were WHM resellers and upgraded to VPS with root cPanel, however there is no main easy way to migrate WHM reseller account to a root account under WHM, that&#8217;s where we started playing around and making our own script.  You need root access to the source and final server to do this, this looks like the fastest way to do this at the moment.</p>
<p>First of all, we need to get all the accounts and create a backup of their accounts, this is done using a couple of bash lines and parsing the file <code>/etc/trueuserowners</code>.  That file contains every account on the server and the accounts that own it.  This following will go over that file, take out the resellers accounts and back them up one by one.  The best way to make sure no mistake happens is to ensure that <code>/home</code> or <code>/home2</code> or any other <code>/home</code> directories because the <code>/scripts/pkgacct</code> creates them there.  We also use <code>cpuwatch</code> not to create excessive load on the server when creating the backup.  It will stop the process once load averages go higher than 10.</p>
<p><code>for i in `cat /etc/trueuserowners | grep <strong>resellerusername</strong> | awk -F ':' '{ print $1; }'`;<br />
do /usr/local/cpane/bin/cpuwatch 10 /scripts/pkgacct $i;<br />
done;</code></p>
<p>Usually this takes a while so this is what you can do if it&#8217;s halfway done to save time</p>
<p><code>/usr/bin/rsync --delete -avvxHt --progress -e ssh /home/cpmove-* 1.2.3.4:~</code></p>
<p>This will start moving the files from the old server to the new one, we use <code>rsync</code> so that we can just run it again after the full backup is done so we don&#8217;t have to restart the whole process again.  Once it&#8217;s done and all data has been moved, another loop, I did this one quickly however I think it could be cleaner, if someone has a better way to do with (regexp?), please let me know.</p>
<p><code>for i in `ls | grep cpmove- | awk -F '.' '{ print $1 }' | awk -F '-' '{ print $2 }'`;<br />
do /scripts/restorepkg $i;<br />
done;</code></p>
<p>After finishing that, you should be all done!</p>
]]></content:encoded>
			<wfw:commentRss>http://momotonic.com/2008/12/30/migrating-cpanel-reseller-accounts-with-root-whm-access/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cPanel backup clean-up</title>
		<link>http://momotonic.com/2008/02/23/cpanel-backup-clean-up/</link>
		<comments>http://momotonic.com/2008/02/23/cpanel-backup-clean-up/#comments</comments>
		<pubDate>Sat, 23 Feb 2008 07:24:30 +0000</pubDate>
		<dc:creator>Mo</dc:creator>
				<category><![CDATA[backup]]></category>
		<category><![CDATA[cpanel]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://momotonic.com/?p=6</guid>
		<description><![CDATA[One of the major pluses of cPanel that it doesn’t delete the backup of the account when terminating an account and neither it does remove it on the next backup run, while that can be a good thing if the customer comes back, on the long term, the backup drive starts to slowly run out [...]]]></description>
			<content:encoded><![CDATA[<p>One of the major pluses of cPanel that it doesn’t delete the backup of the account when terminating an account and neither it does remove it on the next backup run, while that can be a good thing if the customer comes back, on the long term, the backup drive starts to slowly run out of space and eventually these big accounts that have been stored for a while will need to be removed.  I had to go cleanup the backup of one of the servers and I was not about to read them account-by-account however I have used my basic bash coding skills to whip up a small code that helps me in the process!</p>
<p>The code isn’t long at all and it isn’t anything genius, first I generate a small list of the accounts that are in the backup directory, we only run weekly backups and our backup is mounted at <code>/backup</code> so here is the command that we used first:</p>
<p><code>ls /backup/cpbackup/weekly/ &gt; accts.backup</code></p>
<p>Now, a small loop that I created so that it filters out all the users that are in the backup directory but are not existent on the server anymore (or do not have the same username).</p>
<p><code>for i in `ls /home/`; do<br />
replace $i '' -- accts.backup<br />
done</code></p>
<p>There was a lot of accounts to be removed or deleted as this servers’ backups have been left hanging for a while so it would be a very hard task to actually find the accounts that have high disk usage so I made the following script that takes the size of each one of the accounts and puts it in a file.</p>
<p><code>for i in `cat accts.backup`; do<br />
du -s /backup/cpbackup/weekly/$i<br />
done &gt; accts.size</code></p>
<p>After that, we make our life a lot easier by sorting the results by the size, however, <strong>there is one dangerous thing I warn you from, the “dirs” directory might appear as the biggest one but it contains usually MySQL files and configuration files which are very important</strong>, you should simply ignore it.</p>
<p><code>sort –n accts.size &gt; accts.sorted</code></p>
<p>Now, you have a file with all the accounts that do not exist on the server but have backups with their size sorted, you can just go and clean them up as you go, until then, I go back to erasing these useless space hogs!</p>
]]></content:encoded>
			<wfw:commentRss>http://momotonic.com/2008/02/23/cpanel-backup-clean-up/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
