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
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