<?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>theootz dot com &#187; online sync</title> <atom:link href="http://www.theootz.com/tag/online-sync/feed/" rel="self" type="application/rss+xml" /><link>http://www.theootz.com</link> <description>tech, programming, rants and randomonium!</description> <lastBuildDate>Mon, 06 Sep 2010 03:24:46 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0.1</generator> <image><link>http://www.theootz.com</link> <url>http://theootz.com/wp-content/cbnet-favicon/favicon.gif</url><title>theootz dot com</title> </image> <atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/> <item><title>Your site, saved and backed up on the S3 cloud!</title><link>http://www.theootz.com/2010/03/your-site-saved-and-back-up-on-the-s3-cloud/</link> <comments>http://www.theootz.com/2010/03/your-site-saved-and-back-up-on-the-s3-cloud/#comments</comments> <pubDate>Sat, 20 Mar 2010 18:56:02 +0000</pubDate> <dc:creator>theootz</dc:creator> <category><![CDATA[Random]]></category> <category><![CDATA[programming]]></category> <category><![CDATA[Amazon]]></category> <category><![CDATA[amazon s3]]></category> <category><![CDATA[backup scripts]]></category> <category><![CDATA[bash]]></category> <category><![CDATA[online backup]]></category> <category><![CDATA[online sync]]></category> <category><![CDATA[projects]]></category> <category><![CDATA[script]]></category> <category><![CDATA[server backups]]></category> <category><![CDATA[theootz]]></category><guid isPermaLink="false">http://www.theootz.com/?p=226</guid> <description><![CDATA[<p>I got sick of having to do backups manually and then manually saving them somewhere&#8230;then I wondered if it&#8217;d be possible to use my S3 service to back up my website? I mean, I&#8217;m already using it as a content distribution system but having a full backup of all files + databases would be nice too!</p><h2>What You Need</h2><p>You&#8217;ll need PHP, bash, CRON access and python to get this working. And given the bash/cron requirements, that also means it assumes you&#8217;re running a *nix based server. It&#8217;s probably possible to get the requirements down, but I just wanted to[&#8230;] <a href="http://www.theootz.com/2010/03/your-site-saved-and-back-up-on-the-s3-cloud/" class="read_more">read more</a></p>No related posts.]]></description> <content:encoded><![CDATA[<p>I got sick of having to do backups manually and then manually saving them somewhere&#8230;then I wondered if it&#8217;d be possible to use my S3 service to back up my website? I mean, I&#8217;m already using it as a content distribution system but having a full backup of all files + databases would be nice too!</p><h2>What You Need</h2><p>You&#8217;ll need PHP, bash, CRON access and python to get this working. And given the bash/cron requirements, that also means it assumes you&#8217;re running a *nix based server. It&#8217;s probably possible to get the requirements down, but I just wanted to get something done quick and it&#8217;s what I came up with.</p><h2>The Files</h2><h4>backup.sh</h4><p>First up is the bash script (based on <a href="http://www.howtogeek.com/wiki/Tweaking_a_Dedicated_Virtual_Web_Server#Backups">this one</a>) that does most of the work. It will tar+gzip all your site files, export your database(s), and remove old backup files (+5 days old) when necessary. You should only really have to edit the top part of the script. Make sure you remember what you set your <span style="text-decoration: underline;">BACKUP_DIR</span> and <span style="text-decoration: underline;">FILES_DIR</span> to &#8211; you&#8217;ll need them in other scripts later on.</p><pre class="brush: bash;">
#!/bin/sh

# EDIT THIS PART ------------------
# where all these backup scripts are stored
BACKUP_DIR=/home/theootz/backups

# where you want to keep all the actual backup folders
FILES_DIR=/home/theootz/backups/files

# where all your html files reside
HTML_DIR=/home/theootz/public_html

# your MySQL database name, username and password
SQL_USER1=myusername1
SQL_PASS1=mypass1
SQL_DB1=mydb1

# a second database
# Uncomment these lines if you want to back up a second database.
# Also uncomment the line specified below!
# You can also add more databases and follow the same format.
#SQL_USER2=myusername2
#SQL_PASS2=mypass2
#SQL_DB2=mydb2
# STOP EDITING ------------------

THEDATE=`date +%Y-%m-%d_%H-%M-%S`

mkdir -p $BACKUP_DIR/files

mysqldump -u${SQL_USER1} -p${SQL_PASS1} ${SQL_DB1} &gt; ${FILES_DIR}/${THEDATE}_db1backup.sql

# Uncomment the line below if have a second database to back up
#mysqldump -u${SQL_USER2} -p${SQL_PASS2} ${SQL_DB2} &gt; ${FILES_DIR}/${THEDATE}_db2backup.sql

tar -cf ${FILES_DIR}/${THEDATE}_site.tar ${HTML_DIR}
gzip ${FILES_DIR}/${THEDATE}_site.tar

find ${FILES_DIR}/*site* -mtime +5 -exec rm {} \;
find ${FILES_DIR}/*db* -mtime +5 -exec rm {} \;
</pre><h4>backup_upload.py</h4><p>Next is the Python script to upload the files. It uses a PHP library that I&#8217;ll give more information on below.</p><pre class="brush: python;">
import sys
import os

########## Make sure these values match the ones you set in your shell script!
BACKUP_DIR = &quot;/home/theootz/backups&quot;
FILES_DIR = &quot;/home/theootz/backups/files&quot;

# this needs to be changed to reflect your settings on your s3 account
S3_BUCKET = &quot;theootz&quot;
S3_FOLDER = &quot;mysite/backups&quot;
##########

j = os.path.join
fname = os.path.basename(sys.argv[1])
cmdstr = j(BACKUP_DIR, &quot;s3.php&quot;) + &quot; put &quot; + \
    j(FILES_DIR, fname) + &quot; &quot; + \
    j(S3_BUCKET, j(S3_FOLDER, fname.split(&quot;_&quot;)[-1]))

os.system(cmdstr)
</pre><h4>PHP S3</h4><p>The python script uses a PHP library to do all the S3 uploading work. The original is available <a href="http://edoceo.com/creo/phps3tk">here</a>.</p><p>I had to edit a few paths in the php library to get it to work, so if you want to download my version it&#8217;s available here:</p> <a href="http://www.theootz.com/downloads/PHP+Amazon+S3+Library" title="Downloaded 43 times">PHP Amazon S3 Library</a> - Based on http://edoceo.com/creo/phps3tkA PHP library to access and work with Amazon S3<p>Regardless of which one you pick, make sure you open and edit the s3.php file! You&#8217;ll need to put your S3 keys in there (near the top of the file). It will look something like this:</p><pre class="brush: php;">
// S3_CONF file
$aws_key = null;
$aws_secret = null;
</pre><p>You&#8217;ll want to put your access and secret keys there as strings, as follows:</p><pre class="brush: php;">
// S3_CONF file
$aws_key = &quot;my access key here&quot;;
$aws_secret = &quot;my secret key here&quot;;
</pre><h2>How To Get It All Working?</h2><p>Ok, so you&#8217;ve got the files. Now upload them to your web server to your <span style="text-decoration: underline;">BACKUP_DIR</span> folder (whatever you choose it as, I picked /home/theootz/backups). Finally, take the files from the the PHP S3 library and put them in your <span style="text-decoration: underline;">BACKUP_DIR</span> as well. This should leave you with the following files in a single folder:</p><ul><li>backup.sh</li><li>backup_upload.py</li><li>s3sync.php</li><li>s3.php</li><li>libs3.php</li><li>libaws.php</li></ul><p>I&#8217;m pretty sure most of the files from the S3 library aren&#8217;t needed but once again not something I bothered to check.</p><p>Now you&#8217;ll want to enable execution for all our scripts. You can do this by running the following commands while in your <span style="text-decoration: underline;">BACKUP_DIR</span> folder:</p><pre class="brush: bash;">
chmod u+x backup.sh
chmod u+x backup_upload.py
chmod u+x s3.php
</pre><p>At this point, you can go ahead and run backup.sh and see if everything worked. If it did, then we can set up the cron jobs to have this all work automatically for us <img src='http://www.theootz.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>You&#8217;ll want to add two entries to cron. The first entry will run our backup.sh on a daily basis for us. This will give us 5 days worth of backups at any one point. The second script will upload our latest backup to the S3 service, replacing whatever is already there.</p><pre class="brush: plain;">
1       1       *       *       *       /path/to/BACKUP_DIR/backup.sh
1       1       *       *       *       find /path/to/FILES_DIR/* -mtime 0 -exec python /path/to/BACKUP_DIR/backup_upload.py '{}' \;
</pre><p>Make sure you edit the paths to reflect the way you have it configured for your system! For example, my cron jobs look like this:</p><pre class="brush: plain;">
0       0       *       *       *       /home/theootz/backups/backup.sh
0       0       *       *       0       find /home/theootz/backups/files/* -mtime 0 -exec python /home/theootz/backups/backup_upload.py '{}' \;
</pre><h2>Done!</h2><p>And that&#8217;s it <img src='http://www.theootz.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> Your website along with databases and other content will now be backed up daily to the server itself, and uploaded to your S3 account weekly. If you wanna be super extra paranoid you can download the backups from the <span style="text-decoration: underline;">FILES_DIR</span> yourself or <a href="http://www.howtogeek.com/wiki/Tweaking_a_Dedicated_Virtual_Web_Server#Sync_Backups_Off-Site_With_Rsync">use rsync</a> or something similar to automate that as well. One idea is perhaps sending it to your e-mail &#8211; use that g-mail space for something right? <img src='http://www.theootz.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /></p><p>Hope that&#8217;s some help to someone <img src='http://www.theootz.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>No related posts.</p>]]></content:encoded> <wfw:commentRss>http://www.theootz.com/2010/03/your-site-saved-and-back-up-on-the-s3-cloud/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Jungle Disk &#8211; continued</title><link>http://www.theootz.com/2010/02/jungle-disk-continued/</link> <comments>http://www.theootz.com/2010/02/jungle-disk-continued/#comments</comments> <pubDate>Thu, 25 Feb 2010 01:01:22 +0000</pubDate> <dc:creator>theootz</dc:creator> <category><![CDATA[Rants]]></category> <category><![CDATA[dropbox]]></category> <category><![CDATA[ESET]]></category> <category><![CDATA[jungle disk]]></category> <category><![CDATA[mesh]]></category> <category><![CDATA[microsoft]]></category> <category><![CDATA[mozy]]></category> <category><![CDATA[odd errors]]></category> <category><![CDATA[online backup]]></category> <category><![CDATA[online sync]]></category><guid isPermaLink="false">http://www.theootz.com/?p=150</guid> <description><![CDATA[<p>So turns out Jungle Disk was not the culprit&#8230;it instead appears to be &#8212; NOD32? WTFARK. Dammit ESET!</p><p>Anyways, long story short &#8211; un-installing NOD32 and installing Microsoft Security Essentials (which is more than good enough anyways) seems to let me sync things. Jungle Disk is still giving odd errors but I&#8217;ll see if I can work through them.</p><p>Not ready to ditch Dropbox yet &#8212; but it does keep reminding me I&#8217;m getting close to running out of space :/</p><p>Related posts:<ol><li><a href='http://www.theootz.com/2010/02/jungle-disk-great-idea-but/' rel='bookmark' title='Permanent Link: Jungle Disk &#8211; great idea, but&#8230;'>Jungle Disk &#8211; great idea, but&#8230;</a></li></ol></p>Related posts:<ol><li><a href='http://www.theootz.com/2010/02/jungle-disk-great-idea-but/' rel='bookmark' title='Permanent Link: Jungle Disk &#8211; great idea, but&#8230;'>Jungle Disk &#8211; great idea, but&#8230;</a></li></ol>]]></description> <content:encoded><![CDATA[<p>So turns out Jungle Disk was not the culprit&#8230;it instead appears to be &#8212; NOD32? WTFARK. Dammit ESET!</p><p>Anyways, long story short &#8211; un-installing NOD32 and installing Microsoft Security Essentials (which is more than good enough anyways) seems to let me sync things. Jungle Disk is still giving odd errors but I&#8217;ll see if I can work through them.</p><p>Not ready to ditch Dropbox yet &#8212; but it does keep reminding me I&#8217;m getting close to running out of space :/</p><p>Related posts:<ol><li><a href='http://www.theootz.com/2010/02/jungle-disk-great-idea-but/' rel='bookmark' title='Permanent Link: Jungle Disk &#8211; great idea, but&#8230;'>Jungle Disk &#8211; great idea, but&#8230;</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://www.theootz.com/2010/02/jungle-disk-continued/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Jungle Disk &#8211; great idea, but&#8230;</title><link>http://www.theootz.com/2010/02/jungle-disk-great-idea-but/</link> <comments>http://www.theootz.com/2010/02/jungle-disk-great-idea-but/#comments</comments> <pubDate>Sat, 20 Feb 2010 10:23:33 +0000</pubDate> <dc:creator>theootz</dc:creator> <category><![CDATA[Rants]]></category> <category><![CDATA[dropbox]]></category> <category><![CDATA[jungle disk]]></category> <category><![CDATA[mesh]]></category> <category><![CDATA[microsoft]]></category> <category><![CDATA[mozy]]></category> <category><![CDATA[online backup]]></category> <category><![CDATA[online sync]]></category><guid isPermaLink="false">http://www.theootz.com/?p=91</guid> <description><![CDATA[<p>&#8230;doesn&#8217;t really seem to work as advertised. The story starts a few days ago when I realized that my free dropbox account was nearing its full capacity. I contemplated creating a few ghost accounts to get that extra gig or so of free space but figured that eventually I&#8217;d end up in the same situation once again. Considering how much I used the cloud storage I decided it may be time to finally put some money into a paid-for service.</p><p>Problem with dropbox&#8217;s paid service however, was that I was using only 2gb. It seemed like overkill to upgrade to[&#8230;] <a href="http://www.theootz.com/2010/02/jungle-disk-great-idea-but/" class="read_more">read more</a></p>Related posts:<ol><li><a href='http://www.theootz.com/2010/02/jungle-disk-continued/' rel='bookmark' title='Permanent Link: Jungle Disk &#8211; continued'>Jungle Disk &#8211; continued</a></li><li><a href='http://www.theootz.com/2010/03/your-site-saved-and-back-up-on-the-s3-cloud/' rel='bookmark' title='Permanent Link: Your site, saved and backed up on the S3 cloud!'>Your site, saved and backed up on the S3 cloud!</a></li><li><a href='http://www.theootz.com/2010/02/da-stank-bank-uploader/' rel='bookmark' title='Permanent Link: Da Stank Bank &#8220;Uploader&#8221;'>Da Stank Bank &#8220;Uploader&#8221;</a></li></ol>]]></description> <content:encoded><![CDATA[<p>&#8230;doesn&#8217;t really seem to work as advertised. The story starts a few days ago when I realized that my free dropbox account was nearing its full capacity. I contemplated creating a few ghost accounts to get that extra gig or so of free space but figured that eventually I&#8217;d end up in the same situation once again. Considering how much I used the cloud storage I decided it may be time to finally put some money into a paid-for service.</p><p>Problem with dropbox&#8217;s paid service however, was that I was using only 2gb. It seemed like overkill to upgrade to a 50gb account for $10/month. I then remembered from a while back when I was first looking into cloud backup/sync software of one called Jungle Disk. It sounded great &#8211; uses Amazon S2 (as does dropbox) but with an open source client that gave you far more controla. Only reason I went with dropbox was because it was free and suited my needs at the time. So, it was time to give Jungle Disk another shot.</p><p>The sign up, payment and install processes went without a hitch. I decided to go with the &#8220;Jungle Disk Desktop&#8221; version, and hey turned out that with the base monthly fee they decided to include 5gb storage too &#8211; great! Payment was processed instantly and away I went!</p><p>On installing the program, it presents you with a wizard to help you set up your first &#8216;drive&#8217;. I figured I&#8217;d just enable all options and go from there &#8211; whether that&#8217;s a good thing or not I don&#8217;t know. To begin with, I wanted to sync my &#8220;My Dropbox&#8221; folder and if all goes well, I&#8217;d start with other folders too maybe &#8211; who knows? Yea, never got that far though. I set it to my drop box folder and let it sync over night. Waking up in the morning and expecting it to be complete I instead see several errors complaining it wasn&#8217;t able to upload one file or another and failed. It didn&#8217;t just skip the file (which from what I can tell, it&#8217;s supposed to!) but kept trying that same file over and over again until it finally gave up. So I figured, yea sure first time with the software &#8211; maybe it&#8217;s conflicting with dropbox already running in the background? So I gave that a close, and tried again. It got to the same file and stopped. No errors this time though (I was only able to check because of the logs I turned on from curiosity). Made changes to files? NEVER updated. I tried viewing what was saved on my disk via the virtual network drive &#8211; it only got bits of 2 main folders from about a dozen. Horrible!</p><p>Essentially, I&#8217;ve spent the last two days fighting with a horrible piece of software. It&#8217;s been constantly crashing on me whenever I try to make changes to configuration. And I&#8217;ve been making config changes trying to get it to sync successfully, if only just once! But every time it starts syncing, it gets to the same files and goes into an endless loop. Click cancel on the upload for that file? And it crashes! One of the files it was hanging up on was insignificant, so I decided to delete it but sure enough it finds another file to hang on.</p><p>I got frustrated to the point where I&#8217;ve decided to delete the virtual disk and try starting again. See where that leads me. If it -still- fails then I&#8217;ll contact support and see if the money I&#8217;m paying is worth it at all. If not, then I guess I&#8217;ll find something else. I&#8217;ve recently learned of another service called <a title="Mozy" href="https://mozy.com/" target="_blank">Mozy</a> that seems to offer unlimited backup for around the same price as Jungle Disk&#8217;s base price but unlimited hosting of anything always makes me weary &#8211; more research would definitely be required. I&#8217;ve also been toying around with using Microsoft Mesh but the software is still a bit sluggish and doesn&#8217;t always sync properly. It also has no revision history which I&#8217;ve found can be VERY helpful!</p><p>Anyone else have any experience with Jungle Disk or other online backup/sync solutions? Any recommendations?</p><p>Related posts:<ol><li><a href='http://www.theootz.com/2010/02/jungle-disk-continued/' rel='bookmark' title='Permanent Link: Jungle Disk &#8211; continued'>Jungle Disk &#8211; continued</a></li><li><a href='http://www.theootz.com/2010/03/your-site-saved-and-back-up-on-the-s3-cloud/' rel='bookmark' title='Permanent Link: Your site, saved and backed up on the S3 cloud!'>Your site, saved and backed up on the S3 cloud!</a></li><li><a href='http://www.theootz.com/2010/02/da-stank-bank-uploader/' rel='bookmark' title='Permanent Link: Da Stank Bank &#8220;Uploader&#8221;'>Da Stank Bank &#8220;Uploader&#8221;</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://www.theootz.com/2010/02/jungle-disk-great-idea-but/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
Page Caching using disk (enhanced) (user agent is rejected)
Database Caching 80/159 queries in 0.184 seconds using disk
Object Caching 1490/1510 objects using disk

Served from: www.theootz.com @ 2010-09-06 12:40:21 -->