The Kleptones – A Night at the Hip-Hopera
Gay Bar by Electric Six, video by Joel Veitch rathergood.com
Hermit Crab Rave
Turn Down For What, Vidler’s Style
The Free Masons Discarded 1987 IBM Clone PC
Chicken Chicken Chicken
History of the Buffalo Wing
Tag Archive for computers
How Is A Rave Like A Writing Desk
Automated Backup from EC2 to S3
The server that hosts Common Folk Collective also hosts a handful of other sites. As a responsible hosting provider I try to ensure that if anything were to happen to the server all is not lost and I’d be able to get everything up and running again pretty quickly.
One thing I do is take nightly backups of the database server and all of the files. This is a guide to help you do the same.
Login into your AWS console. In the upper righthand corner click on “Security Credentials”
On the left side click on the Groups
Select “Create a New Group”
Give it a memorable name.
Set “Amazon S3 Full Access”
Next you will create a new user.
Download the credentials for the new user.
The contents of the file will look something like this:
Next add this user to the group you just created.
Next you have to create a bucket
Next you should edit the Lifecycle rules of your backups
One of the cool features of S3 is that you can retire backups. This is handy because Amazon charges you per MB. I keep my backups around for 30 days and then they disappear. If you want to save them for longer you may also retire them to Amazon Glacier where they charge much less for storage with the caveat that it will take a few hours to retrieve them.
Now you have everything in place to start backing up. Your first step is to grab a great set of tools to put files on S3 using only bash.
I put these files in /home/ec2-user/bin/ I also added the following scriptÂ
#!/bin/bash
NOWDATE=`date +%Y-%m-%d-%H-%M`
cd /home/ec2-user/bin/
/usr/bin/mysqldump -u root -pDB_PASSWORD --all-databases > all_db-$NOWDATE.sql
/bin/gzip all_db-$NOWDATE.sql
/home/dan/bin/s3-put -k 20_CHARACTER_STRING -s /home/ec2-user/bin/.robot-key -T all_db-$NOWDATE.sql.gz /robot-backups/all_db-$NOWDATE.sql.gz
/bin/rm all_db-$NOWDATE.sql.gz
/bin/tar czf all_sites-$NOWDATE.tgz /usr/local/www/*
/home/dan/bin/s3-put -k 20_CHARACTER_STRING -s /home/ec2-user/bin/.robot-key -T all_sites-$NOWDATE.tgz /robot-backups/all_sites-$NOWDATE.tgz
/bin/rm all_sites-$NOWDATE.tgz
The 20_CHARACER_STRING is the first string in the credentials you downloaded earlier. For the 40 character string put that into a file named .robot-key.
Don’t forget to chmod 700 on the your backup-file.
Test it once if you’ve its working you’ll see everything show up in your S3 bucket.
Now add a cron job to do it nightly. Run the command “crontab -e” and add the following line:
@daily /home/ec2-user/bin/backup.sh > /dev/null
This should run every night at midnight.
If I’ve missed anything please let me know in the comments.
Using both Java 1.7 and 1.6 on Mountain Lion
Here’s the situation you need to use both JDK 1.7 and JDK 1.6 for different projects you are working on with Mac OS X. You already have Java 1.6 installed and ran the installer for Java 1.7 from Oracle but no matter what you do java -version will only show 1.6.
Here’s what you do to use 1.7 run the following:
sudo rm /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/ /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
To use 1.6 run the following:
sudo rm /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
sudo ln -s /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
Note you may have to adjust for the exact version for example if you installed jdk1.7.0_12.jdk.
Here’s an example:
thor:~ dan$ sudo rm /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
thor:~ dan$ sudo ln -s /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
thor:~ dan$ java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06-451-11M4406)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01-451, mixed mode)
thor:~ dan$ sudo rm /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
thor:~ dan$ sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/ /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
thor:~ dan$ java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
Java, Hackers and Bears. Oh My!
A lot of attention has been paid recently to hackers exploiting Java to access your computers and do bad things. This is true and it is scary but there is a lot of confusion about what that means and what you need to do to protect yourself.
First I need to point out that Java and JavaScript are VERY different. This exploit does not apply to JavaScript and disabling it in your browser will make surfing the web suck.
If you have no need for Java all together it wouldn’t hurt to uninstall it from your computer but there are a lot of popular applications that require Java to run. Adobe Illustrator requires Java, the wonderful alternative to Microsoft Office, Libre Office uses it.* As do many others.
If you want to take the less extreme route yet still be safe, you should disable Java in the browser (Comprehensive instructions from Oracle the makers of Java), this will mean that some sites and somethings will not work. This is usually okay though because Java in the browser, known formally as Applets, isn’t very popular anymore. Disabling Java in your browser will protect you from the hackers.
The last case is that you, do need Java Applets to be productive. Some VPNs and Video Conferencing applications require Java. If you fall into this category I suggest you download a separate browser that you use specifically for this purpose and use only for this purpose and enable Java in that browser. Opera is a free browser that you can use for this purpose.
To summarize
- Java and JavaScript are very different
- Disable Java in your browser
- If you need Java Applets use a specific browser with Java enabled only for sites that require it
This has been a PSA from Common Folk Collective.
*Seriously if you are using Open Office or considering buying MS Office you should check Libre Office out first
UPDATE: I heard a good way to explain Java v JavaScript. Java is JavaScript as Ham is to Hamster.