I just found out how to make my Google Sites backup script almost non-interactive, so I decided to share. My usage pattern of this script is that I run it every month in the Linux console, and then the weekly backup of my hard disk takes care to additionally back up the information.
Why bother backing up Google Sites?
While Google are very reliable and probably they will never fail me here, I want to have an offline backup of my Google Sites pages in case someone steals my Google Account. So I back up. Online and offline, every week.
The backup script uses the wonderful free Java application “Google Sites Liberation“. My script is actually more like a sample Bash usage of this Java tool. You need to download the .jar file and store it in the same directory as the backup script. The source code follows:
#!/bin/bash set -e set -u set -o pipefail trap 'echo "ERROR: Abnormal exit." >&2' ERR # config BEGIN GUSER='username@gmail.com' WIKI_LIST='wiki1 wiki2 wiki3' JAR_BIN='google-sites-liberation-1.0.4.jar' ROOT_BACKUP_DIR='./sites.google.com' # config END echo "We are using '$JAR_BIN'. Check for a newer version:" echo ' http://code.google.com/p/google-sites-liberation/downloads/list' read echo "The directory '$ROOT_BACKUP_DIR' will be deleted!!!" echo 'Press Enter to confirm.' read rm -rf "$ROOT_BACKUP_DIR" mkdir "$ROOT_BACKUP_DIR" echo -n "Enter the password for '$GUSER': " read -s -r -e PASS echo ; echo for wiki in $WIKI_LIST ; do BACKUP_DIR="$ROOT_BACKUP_DIR/$wiki" echo "*** Exporting '$wiki' in '$BACKUP_DIR'..." echo "Press Enter to continue." read mkdir "$BACKUP_DIR" java -cp "$JAR_BIN" com.google.sites.liberation.export.Main \ -w "$wiki" \ -u "$GUSER" \ -p "$PASS" \ -f "$BACKUP_DIR" echo done
References:
July 14, 2012 at 1:30 am
Hi, I am trying to backup my Google Sites where I am using Norwegian special language character set like “Æ” and “Ø”.
This is my command from windoes:
java -cp google-sites-liberation-1.0.4.jar com.google.sites.liberation.export.Main -h “sites.google.com” -w “mygooglesite” -u “myGoogleUsername” -p “mygmailpassword” -f “c:\backup\mygooglesite”
But “Æ” and “Ø”(æ and ø) is not showing correctly after download.
For instance the Norwegian word “Påvirker” shows like “pÃ¥virker” etc.
Is there any way to fix and change this so that all characters are downloading correctly ?
Thanks in advance
July 15, 2012 at 3:24 pm
This seems like a known issue with “Google Sites Liberation” – reported issue 63. As comment #2 there states, the HTML pages are correctly saved in UTF-8, it’s just that the <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ /> tag is missing. If you change the encoding in your browser to UTF-8 while viewing your page, you should be all set.
July 15, 2012 at 9:59 pm
I just did what you told me and it worked fine 🙂 Thanks.
Is there a way to edit the google-sites-liberation-1.0.4.jar file and correct the tag myself? Thank you.
July 15, 2012 at 10:02 pm
You’re welcome. I’m in no way involved in the development of “Google Sites Liberation”. Try to ask in their issue ticket #63.