4 ms·
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
by aschobel 18y ago
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 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?externalID=132 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
- silvestrov 18y agoYou 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.
- aschobel 18y agoI'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 http://3banana.com/pics/S3BackupTest.java