News for hackers. Stuff that matters.
Re:Ask HN: What is your startup's backup policy? by gcv on Sunday January 04, 2009 @03:59PM (#419523)
For the S3 users here, if you don't mind sharing: how do you actually do it? Do you use duplicity, Jungledisk, s3rsync.com, the s3sync utilities, tarsnap, something homegrown? Do your backups require incremental updates, snapshots, encryption?
Re:Ask HN: What is your startup's backup policy? by aschobel on Sunday January 04, 2009 @05:57PM (#419674)
We have a trivial implementation that does a full backup and prepends the date/time stamp to the backed up filename.

We call it from crontab to run once a day with the following:

java -jar s3backup.jar /etc/iptables-save /etc/lighttpd/lighttpd.conf ...

You just list out which files you wanted backed up, and then they show up in your bucket as: yyyyMMddHHmmssZ-filename

Code is here: http://3banana.com/pics/S3Backup.java

You need Amazon's Java S3 libary which you can snag from here: http://developer.amazonwebservices.com/connect/entry.jspa?ex...

If you want to toss it into a JAR and simplify startup use the following META-INF/MANIFEST.MF

  Manifest-Version: 1.0
  Created-By: IntelliJ IDEA
  Main-Class: com.threebanana.S3Backup
Re:Ask HN: What is your startup's backup policy? by silvestrov on Sunday January 04, 2009 @06:11PM (#419684)
You forgot to close the BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file)); so you'll run out of file descriptions if backing up too many files. And bis.read(jpgByte); doesn't necessary read all of the files; at least som java versions on some Solaris versions doesn't.
Re:Ask HN: What is your startup's backup policy? by aschobel on Sunday January 04, 2009 @08:08PM (#419799)
I'm so incredibly sorry about that. The contract for InputStream.read is very clear, that was needlessly sloppy.

New version is up. Also includes the unit test that should have been there in the first place. grumble

http://3banana.com/pics/S3BackupTest.java