Fixing CrashPlan in Xubuntu 14.04

I run CrashPlan on a variety of devices, but invariably access them in a "headless" manner from a computer running Xubuntu (currently 14.04).

After upgrading to 14.04, however, CrashPlan stopped working. This is a known problem, but unfortunately they haven't fixed the issue - simply created an obscure post so people can apply a workaround themselves!

I applied the workaround manually, and all was fine - until CrashPlan was automatically updated and stopped working again. So I decided I would use a script to initiate the headless CrashPlan connection and also ensure that the workaround was applied automatically!

It seems that this problem may well affect other 14.04 users, not just Xubuntu but also Ubuntu (and possibly more), so without further ado here's the script... (it's also attached):


ADDRESS="[email protected]"

### Port-modding function
# Params:
#   servicePortLine
function portCrashPlan {
  grep "^$1\$" /usr/local/crashplan/conf/ >/dev/null
  if [ "$?" -ne "0" ]; then
    sudo sed -i "/servicePort/c\\$1" /usr/local/crashplan/conf/

### Test run.conf file and fix for 14.04 if necessary
# Check if fix is already applied
grep "\-Dorg.eclipse.swt.browser.DefaultType=mozilla" /usr/local/crashplan/bin/run.conf >/dev/null
# If it isn't...
if [ "$?" -ne "0" ]; then
  # Read current GUI_JAVA_OPTS line
  LINE=`grep "GUI_JAVA_OPTS" /usr/local/crashplan/bin/run.conf`
  # Remove trailing " and append fix (with trailing ")
  NEWLINE="${LINE%\"} -Dorg.eclipse.swt.browser.DefaultType=mozilla\""
  # Replace the original with the new
  sudo sed -i "/GUI_JAVA_OPTS/c\\$NEWLINE" /usr/local/crashplan/bin/run.conf

# Modify port if necessary (will only use sudo if needed)
portCrashPlan "servicePort=42430"

# Connect via SSH, forwarding local port to remote address, and runs command
"sleep 100" to ensure the connection stays open while CrashPlan launches...
# the connection is then 
held open by CrashPlan while its running, and closes
# automatically on exit.

ssh -L 42430:localhost:4243 $ADDRESS "sleep 100"&

# Run CrashPlan!

exit 0

File crashplan.sh1.32 KB