CrashPlan packages for Synology NAS

UPDATE – CrashPlan For Home (green branding) was retired by Code 42 Software on 22/08/2017. See migration notes below to find out how to transfer to CrashPlan for Small Business on Synology at the special discounted rate.

CrashPlan is a popular online backup solution which supports continuous syncing. With this your NAS can become even more resilient, particularly against the threat of ransomware.

There are now only two product versions:

  • Small Business: CrashPlan PRO (blue branding). Unlimited cloud backup subscription, $10 per device per month. Reporting via Admin Console. No peer-to-peer backups
  • Enterprise: CrashPlan PROe (black branding). Cloud backup subscription typically billed by storage usage, also available from third parties.

The instructions and notes on this page apply to both versions of the Synology package.

CrashPlanPRO-Windows

CrashPlan is a Java application which can be difficult to install on a NAS. Way back in January 2012 I decided to simplify it into a Synology package, since I had already created several others. It has been through many versions since that time, as the changelog below shows. Although it used to work on Synology products with ARM and PowerPC CPUs, it unfortunately became Intel-only in October 2016 due to Code 42 Software adding a reliance on some proprietary libraries.

Licence compliance is another challenge – Code 42’s EULA prohibits redistribution. I had to make the Synology package use the regular CrashPlan for Linux download (after the end user agrees to the Code 42 EULA). I then had to write my own script to extract this archive and mimic the Code 42 installer behaviour, but without the interactive prompts of the original.

 

Synology Package Installation

  • In Synology DSM’s Package Center, click Settings and add my package repository:
    Add Package Repository
  • The repository will push its certificate automatically to the NAS, which is used to validate package integrity. Set the Trust Level to Synology Inc. and trusted publishers:
    Trust Level
  • Now browse the Community section in Package Center to install CrashPlan:
    Community-packages
    The repository only displays packages which are compatible with your specific model of NAS. If you don’t see CrashPlan in the list, then either your NAS model or your DSM version are not supported at this time. DSM 5.0 is the minimum supported version for this package, and an Intel CPU is required.
  • Since CrashPlan is a Java application, it needs a Java Runtime Environment (JRE) to function. It is recommended that you select to have the package install a dedicated Java 8 runtime. For licensing reasons I cannot include Java with this package, so you will need to agree to the licence terms and download it yourself from Oracle’s website. The package expects to find this .tar.gz file in a shared folder called ‘public’. If you go ahead and try to install the package without it, the error message will indicate precisely which Java file you need for your system type, and it will provide a TinyURL link to the appropriate Oracle download page.
  • To install CrashPlan PRO you will first need to log into the Admin Console and download the Linux App from the App Download section and also place this in the ‘public’ shared folder on your NAS.
  • If you have a multi-bay NAS, use the Shared Folder control panel to create the shared folder called public (it must be all lower case). On single bay models this is created by default. Assign it with Read/Write privileges for everyone.
  • If you have trouble getting the Java or CrashPlan PRO app files recognised by this package, try downloading them with Firefox. It seems to be the only web browser that doesn’t try to uncompress the files, or rename them without warning. I also suggest that you leave the Java file and the public folder present once you have installed the package, so that you won’t need to fetch this again to install future updates to the CrashPlan package.
  • CrashPlan is installed in headless mode – backup engine only. This will configured by a desktop client, but operates independently of it.
  • The first time you start the CrashPlan package you will need to stop it and restart it before you can connect the client. This is because a config file that is only created on first run needs to be edited by one of my scripts. The engine is then configured to listen on all interfaces on the default port 4243.
 

CrashPlan Client Installation

  • Once the CrashPlan engine is running on the NAS, you can manage it by installing CrashPlan on another computer, and by configuring it to connect to the NAS instance of the CrashPlan Engine.
  • Make sure that you install the version of the CrashPlan client that matches the version running on the NAS. If the NAS version gets upgraded later, you will need to update your client computer too.
  • The Linux CrashPlan PRO client must be downloaded from the Admin Console and placed in the ‘public’ folder on your NAS in order to successfully install the Synology package.
  • By default the client is configured to connect to the CrashPlan engine running on the local computer. Run this command on your NAS from an SSH session:
    echo `cat /var/lib/crashplan/.ui_info`
    Note those are backticks not quotes. This will give you a port number (4243), followed by an authentication token, followed by the IP binding (0.0.0.0 means the server is listening for connections on all interfaces) e.g.:
    4243,9ac9b642-ba26-4578-b705-124c6efc920b,0.0.0.0
    port,--------------token-----------------,binding

    Copy this token value and use this value to replace the token in the equivalent config file on the computer that you would like to run the CrashPlan client on – located here:
    C:\ProgramData\CrashPlan\.ui_info (Windows)
    “/Library/Application Support/CrashPlan/.ui_info” (Mac OS X installed for all users)
    “~/Library/Application Support/CrashPlan/.ui_info” (Mac OS X installed for single user)
    /var/lib/crashplan/.ui_info (Linux)
    You will not be able to connect the client unless the client token matches on the NAS token. On the client you also need to amend the IP address value after the token to match the Synology NAS IP address.
    so using the example above, your computer’s CrashPlan client config file would be edited to:
    4243,9ac9b642-ba26-4578-b705-124c6efc920b,192.168.1.100
    assuming that the Synology NAS has the IP 192.168.1.100
    If it still won’t connect, check that the ServicePort value is set to 4243 in the following files:
    C:\ProgramData\CrashPlan\conf\ui_(username).properties (Windows)
    “/Library/Application Support/CrashPlan/ui.properties” (Mac OS X installed for all users)
    “~/Library/Application Support/CrashPlan/ui.properties” (Mac OS X installed for single user)
    /usr/local/crashplan/conf (Linux)
    /var/lib/crashplan/.ui_info (Synology) – this value does change spontaneously if there’s a port conflict e.g. you started two versions of the package concurrently (CrashPlan and CrashPlan PRO)
  • As a result of the nightmarish complexity of recent product changes Code42 has now published a support article with more detail on running headless systems including config file locations on all supported operating systems, and for ‘all users’ versus single user installs etc.
  • You should disable the CrashPlan service on your computer if you intend only to use the client. In Windows, open the Services section in Computer Management and stop the CrashPlan Backup Service. In the service Properties set the Startup Type to Manual. You can also disable the CrashPlan System Tray notification application by removing it from Task Manager > More Details > Start-up Tab (Windows 8/Windows 10) or the All Users Startup Start Menu folder (Windows 7).
    To accomplish the same on Mac OS X, run the following commands one by one:

    sudo launchctl unload /Library/LaunchDaemons/com.crashplan.engine.plist
    sudo mv /Library/LaunchDaemons/com.crashplan.engine.plist /Library/LaunchDaemons/com.crashplan.engine.plist.bak

    The CrashPlan menu bar application can be disabled in System Preferences > Users & Groups > Current User > Login Items

 

Migration from CrashPlan For Home to CrashPlan For Small Business (CrashPlan PRO)

  • Leave the regular green branded CrashPlan 4.8.3 Synology package installed.
  • Go through the online migration using the link in the email notification you received from Code 42 on 22/08/2017. This seems to trigger the CrashPlan client to begin an update to 4.9 which will fail. It will also migrate your account onto a CrashPlan PRO server. The web page is likely to stall on the Migrating step, but no matter. The process is meant to take you to the store but it seems to be quite flakey. If you see the store page with a $0.00 amount in the basket, this has correctly referred you for the introductory offer. Apparently the $9.99 price thereafter shown on that screen is a mistake and the correct price of $2.50 is shown on a later screen in the process I think. Enter your credit card details and check out if you can. If not, continue.
  • Log into the CrashPlan PRO Admin Console as per these instructions, and download the CrashPlan PRO 4.9 client for Linux, and the 4.9 client for your remote console computer. Ignore the red message in the bottom left of the Admin Console about registering, and do not sign up for the free trial. Preferably use Firefox for the Linux version download – most of the other web browsers will try to unpack the .tgz archive, which you do not want to happen.
  • Configure the CrashPlan PRO 4.9 client on your computer to connect to your Syno as per the usual instructions on this blog post.
  • Put the downloaded Linux CrashPlan PRO 4.9 client .tgz file in the ‘public’ shared folder on your NAS. The package will no longer download this automatically as it did in previous versions.
  • From the Community section of DSM Package Center, install the CrashPlan PRO 4.9 package concurrently with your existing CrashPlan 4.8.3 Syno package.
  • This will stop the CrashPlan package and automatically import its configuration. Notice that it will also backup your old CrashPlan .identity file and leave it in the ‘public’ shared folder, just in case something goes wrong.
  • Start the CrashPlan PRO Synology package, and connect your CrashPlan PRO console from your computer.
  • You should see your protected folders as usual. At first mine reported something like “insufficient device licences”, but the next time I started up it changed to “subscription expired”.
  • Uninstall the CrashPlan 4.8.3 Synology package, this is no longer required.
  • At this point if the store referral didn’t work in the second step, you need to sign into the Admin Console. While signed in, navigate to this link which I was given by Code 42 support. If it works, you should see a store page with some blue font text and a $0.00 basket value. If it didn’t work you will get bounced to the Consumer Next Steps webpage: “Important Changes to CrashPlan for Home” – the one with the video of the CEO explaining the situation. I had to do this a few times before it worked. Once the store referral link worked and I had confirmed my payment details my CrashPlan PRO client immediately started working. Enjoy!
 

Notes

  • The package uses the intact CrashPlan installer directly from Code 42 Software, following acceptance of its EULA. I am complying with the directive that no one redistributes it.
  • The engine daemon script checks the amount of system RAM and scales the Java heap size appropriately (up to the default maximum of 512MB). This can be overridden in a persistent way if you are backing up large backup sets by editing /var/packages/CrashPlan/target/syno_package.vars. If you are considering buying a NAS purely to use CrashPlan and intend to back up more than a few hundred GB then I strongly advise buying one of the models with upgradeable RAM. Memory is very limited on the cheaper models. I have found that a 512MB heap was insufficient to back up more than 2TB of files on a Windows server and that was the situation many years ago. It kept restarting the backup engine every few minutes until I increased the heap to 1024MB. Many users of the package have found that they have to increase the heap size or CrashPlan will halt its activity. This can be mitigated by dividing your backup into several smaller backup sets which are scheduled to be protected at different times. Note that from package version 0041, using the dedicated JRE on a 64bit Intel NAS will allow a heap size greater than 4GB since the JRE is 64bit (requires DSM 6.0 in most cases).
  • If you need to manage CrashPlan from a remote location, I suggest you do so using SSH tunnelling as per this support document.
  • The package supports upgrading to future versions while preserving the machine identity, logs, login details, and cache. Upgrades can now take place without requiring a login from the client afterwards.
  • If you remove the package completely and re-install it later, you can re-attach to previous backups. When you log in to the Desktop Client with your existing account after a re-install, you can select “adopt computer” to merge the records, and preserve your existing backups. I haven’t tested whether this also re-attaches links to friends’ CrashPlan computers and backup sets, though the latter does seem possible in the Friends section of the GUI. It’s probably a good idea to test that this survives a package reinstall before you start relying on it. Sometimes, particularly with CrashPlan PRO I think, the adopt option is not offered. In this case you can log into CrashPlan Central and retrieve your computer’s GUID. On the CrashPlan client, double-click on the logo in the top right and you’ll enter a command line mode. You can use the GUID command to change the system’s GUID to the one you just retrieved from your account.
  • The log which is displayed in the package’s Log tab is actually the activity history. If you are trying to troubleshoot an issue you will need to use an SSH session to inspect these log files:
    /var/packages/CrashPlan/target/log/engine_output.log
    /var/packages/CrashPlan/target/log/engine_error.log
    /var/packages/CrashPlan/target/log/app.log
  • When CrashPlan downloads and attempts to run an automatic update, the script will most likely fail and stop the package. This is typically caused by syntax differences with the Synology versions of certain Linux shell commands (like rm, mv, or ps). The startup script will attempt to apply the published upgrade the next time the package is started.
  • Although CrashPlan’s activity can be scheduled within the application, in order to save RAM some users may wish to restrict running the CrashPlan engine to specific times of day using the Task Scheduler in DSM Control Panel:
    Schedule service start
    Note that regardless of real-time backup, by default CrashPlan will scan the whole backup selection for changes at 3:00am. Include this time within your Task Scheduler time window or else CrashPlan will not capture file changes which occurred while it was inactive:
    Schedule Service Start

  • If you decide to sign up for one of CrashPlan’s paid backup services as a result of my work on this, please consider donating using the PayPal button on the right of this page.
 

Package scripts

For information, here are the package scripts so you can see what it’s going to do. You can get more information about how packages work by reading the Synology 3rd Party Developer Guide.

installer.sh

#!/bin/sh

#--------CRASHPLAN installer script
#--------package maintained at pcloadletter.co.uk


DOWNLOAD_PATH="http://download2.code42.com/installs/linux/install/${SYNOPKG_PKGNAME}"
CP_EXTRACTED_FOLDER="crashplan-install"
OLD_JNA_NEEDED="false"
[ "${SYNOPKG_PKGNAME}" == "CrashPlan" ] && DOWNLOAD_FILE="CrashPlan_4.8.3_Linux.tgz"
[ "${SYNOPKG_PKGNAME}" == "CrashPlanPRO" ] && DOWNLOAD_FILE="CrashPlanPRO_4.*_Linux.tgz"
if [ "${SYNOPKG_PKGNAME}" == "CrashPlanPROe" ]; then
  CP_EXTRACTED_FOLDER="${SYNOPKG_PKGNAME}-install"
  OLD_JNA_NEEDED="true"
  [ "${WIZARD_VER_483}" == "true" ] && { CPPROE_VER="4.8.3"; CP_EXTRACTED_FOLDER="crashplan-install"; OLD_JNA_NEEDED="false"; }
  [ "${WIZARD_VER_480}" == "true" ] && { CPPROE_VER="4.8.0"; CP_EXTRACTED_FOLDER="crashplan-install"; OLD_JNA_NEEDED="false"; }
  [ "${WIZARD_VER_470}" == "true" ] && { CPPROE_VER="4.7.0"; CP_EXTRACTED_FOLDER="crashplan-install"; OLD_JNA_NEEDED="false"; }
  [ "${WIZARD_VER_460}" == "true" ] && { CPPROE_VER="4.6.0"; CP_EXTRACTED_FOLDER="crashplan-install"; OLD_JNA_NEEDED="false"; }
  [ "${WIZARD_VER_452}" == "true" ] && { CPPROE_VER="4.5.2"; CP_EXTRACTED_FOLDER="crashplan-install"; OLD_JNA_NEEDED="false"; }
  [ "${WIZARD_VER_450}" == "true" ] && { CPPROE_VER="4.5.0"; CP_EXTRACTED_FOLDER="crashplan-install"; OLD_JNA_NEEDED="false"; }
  [ "${WIZARD_VER_441}" == "true" ] && { CPPROE_VER="4.4.1"; CP_EXTRACTED_FOLDER="crashplan-install"; OLD_JNA_NEEDED="false"; }
  [ "${WIZARD_VER_430}" == "true" ] && CPPROE_VER="4.3.0"
  [ "${WIZARD_VER_420}" == "true" ] && CPPROE_VER="4.2.0"
  [ "${WIZARD_VER_370}" == "true" ] && CPPROE_VER="3.7.0"
  [ "${WIZARD_VER_364}" == "true" ] && CPPROE_VER="3.6.4"
  [ "${WIZARD_VER_363}" == "true" ] && CPPROE_VER="3.6.3"
  [ "${WIZARD_VER_3614}" == "true" ] && CPPROE_VER="3.6.1.4"
  [ "${WIZARD_VER_353}" == "true" ] && CPPROE_VER="3.5.3"
  [ "${WIZARD_VER_341}" == "true" ] && CPPROE_VER="3.4.1"
  [ "${WIZARD_VER_33}" == "true" ] && CPPROE_VER="3.3"
  DOWNLOAD_FILE="CrashPlanPROe_${CPPROE_VER}_Linux.tgz"
fi
DOWNLOAD_URL="${DOWNLOAD_PATH}/${DOWNLOAD_FILE}"
CPI_FILE="${SYNOPKG_PKGNAME}_*.cpi"
OPTDIR="${SYNOPKG_PKGDEST}"
VARS_FILE="${OPTDIR}/install.vars"
SYNO_CPU_ARCH="`uname -m`"
[ "${SYNO_CPU_ARCH}" == "x86_64" ] && SYNO_CPU_ARCH="i686"
[ "${SYNO_CPU_ARCH}" == "armv5tel" ] && SYNO_CPU_ARCH="armel"
[ "${SYNOPKG_DSM_ARCH}" == "armada375" ] && SYNO_CPU_ARCH="armv7l"
[ "${SYNOPKG_DSM_ARCH}" == "armada38x" ] && SYNO_CPU_ARCH="armhf"
[ "${SYNOPKG_DSM_ARCH}" == "comcerto2k" ] && SYNO_CPU_ARCH="armhf"
[ "${SYNOPKG_DSM_ARCH}" == "alpine" ] && SYNO_CPU_ARCH="armhf"
[ "${SYNOPKG_DSM_ARCH}" == "alpine4k" ] && SYNO_CPU_ARCH="armhf"
[ "${SYNOPKG_DSM_ARCH}" == "monaco" ] && SYNO_CPU_ARCH="armhf"
[ "${SYNOPKG_DSM_ARCH}" == "rtd1296" ] && SYNO_CPU_ARCH="armhf"
NATIVE_BINS_URL="http://packages.pcloadletter.co.uk/downloads/crashplan-native-${SYNO_CPU_ARCH}.tar.xz"   
NATIVE_BINS_FILE="`echo ${NATIVE_BINS_URL} | sed -r "s%^.*/(.*)%\1%"`"
OLD_JNA_URL="http://packages.pcloadletter.co.uk/downloads/crashplan-native-old-${SYNO_CPU_ARCH}.tar.xz"   
OLD_JNA_FILE="`echo ${OLD_JNA_URL} | sed -r "s%^.*/(.*)%\1%"`"
INSTALL_FILES="${DOWNLOAD_URL} ${NATIVE_BINS_URL}"
[ "${OLD_JNA_NEEDED}" == "true" ] && INSTALL_FILES="${INSTALL_FILES} ${OLD_JNA_URL}"
TEMP_FOLDER="`find / -maxdepth 2 -path '/volume?/@tmp' | head -n 1`"
#the Manifest folder is where friends' backup data is stored
#we set it outside the app folder so it persists after a package uninstall
MANIFEST_FOLDER="/`echo $TEMP_FOLDER | cut -f2 -d'/'`/crashplan"
LOG_FILE="${SYNOPKG_PKGDEST}/log/history.log.0"
UPGRADE_FILES="syno_package.vars conf/my.service.xml conf/service.login conf/service.model"
UPGRADE_FOLDERS="log cache"
PUBLIC_FOLDER="`synoshare --get public | sed -r "/Path/!d;s/^.*\[(.*)\].*$/\1/"`"
#dedicated JRE section
if [ "${WIZARD_JRE_CP}" == "true" ]; then
  DOWNLOAD_URL="http://tinyurl.com/javaembed"
  EXTRACTED_FOLDER="ejdk1.8.0_151"
  #detect systems capable of running 64bit JRE which can address more than 4GB of RAM
  [ "${SYNOPKG_DSM_ARCH}" == "x64" ] && SYNO_CPU_ARCH="x64"
  [ "`uname -m`" == "x86_64" ] && [ ${SYNOPKG_DSM_VERSION_MAJOR} -ge 6 ] && SYNO_CPU_ARCH="x64"
  if [ "${SYNO_CPU_ARCH}" == "armel" ]; then
    JAVA_BINARY="ejdk-8u151-linux-arm-sflt.tar.gz"
    JAVA_BUILD="ARMv5/ARMv6/ARMv7 Linux - SoftFP ABI, Little Endian 2"
  elif [ "${SYNO_CPU_ARCH}" == "armv7l" ]; then
    JAVA_BINARY="ejdk-8u151-linux-arm-sflt.tar.gz"
    JAVA_BUILD="ARMv5/ARMv6/ARMv7 Linux - SoftFP ABI, Little Endian 2"
  elif [ "${SYNO_CPU_ARCH}" == "armhf" ]; then
    JAVA_BINARY="ejdk-8u151-linux-armv6-vfp-hflt.tar.gz"
    JAVA_BUILD="ARMv6/ARMv7 Linux - VFP, HardFP ABI, Little Endian 1"
  elif [ "${SYNO_CPU_ARCH}" == "ppc" ]; then
    #Oracle have discontinued Java 8 for PowerPC after update 6
    JAVA_BINARY="ejdk-8u6-fcs-b23-linux-ppc-e500v2-12_jun_2014.tar.gz"
    JAVA_BUILD="Power Architecture Linux - Headless - e500v2 with double-precision SPE Floating Point Unit"
    EXTRACTED_FOLDER="ejdk1.8.0_06"
    DOWNLOAD_URL="http://tinyurl.com/java8ppc"
  elif [ "${SYNO_CPU_ARCH}" == "i686" ]; then
    JAVA_BINARY="ejdk-8u151-linux-i586.tar.gz"
    JAVA_BUILD="x86 Linux Small Footprint - Headless"
  elif [ "${SYNO_CPU_ARCH}" == "x64" ]; then
    JAVA_BINARY="jre-8u151-linux-x64.tar.gz"
    JAVA_BUILD="Linux x64"
    EXTRACTED_FOLDER="jre1.8.0_151"
    DOWNLOAD_URL="http://tinyurl.com/java8x64"
  fi
fi
JAVA_BINARY=`echo ${JAVA_BINARY} | cut -f1 -d'.'`
source /etc/profile


pre_checks ()
{
  #These checks are called from preinst and from preupgrade functions to prevent failures resulting in a partially upgraded package
  if [ "${WIZARD_JRE_CP}" == "true" ]; then
    synoshare -get public > /dev/null || (
      echo "A shared folder called 'public' could not be found - note this name is case-sensitive. " >> $SYNOPKG_TEMP_LOGFILE
      echo "Please create this using the Shared Folder DSM Control Panel and try again." >> $SYNOPKG_TEMP_LOGFILE
      exit 1
    )

    JAVA_BINARY_FOUND=
    [ -f ${PUBLIC_FOLDER}/${JAVA_BINARY}.tar.gz ] && JAVA_BINARY_FOUND=true
    [ -f ${PUBLIC_FOLDER}/${JAVA_BINARY}.tar ] && JAVA_BINARY_FOUND=true
    [ -f ${PUBLIC_FOLDER}/${JAVA_BINARY}.tar.tar ] && JAVA_BINARY_FOUND=true
    [ -f ${PUBLIC_FOLDER}/${JAVA_BINARY}.gz ] && JAVA_BINARY_FOUND=true
     
    if [ -z ${JAVA_BINARY_FOUND} ]; then
      echo "Java binary bundle not found. " >> $SYNOPKG_TEMP_LOGFILE
      echo "I was expecting the file ${PUBLIC_FOLDER}/${JAVA_BINARY}.tar.gz. " >> $SYNOPKG_TEMP_LOGFILE
      echo "Please agree to the Oracle licence at ${DOWNLOAD_URL}, then download the '${JAVA_BUILD}' package" >> $SYNOPKG_TEMP_LOGFILE
      echo "and place it in the 'public' shared folder on your NAS. This download cannot be automated even if " >> $SYNOPKG_TEMP_LOGFILE
      echo "displaying a package EULA could potentially cover the legal aspect, because files hosted on Oracle's " >> $SYNOPKG_TEMP_LOGFILE
      echo "server are protected by a session cookie requiring a JavaScript enabled browser." >> $SYNOPKG_TEMP_LOGFILE
      exit 1
    fi
  else
    if [ -z ${JAVA_HOME} ]; then
      echo "Java is not installed or not properly configured. JAVA_HOME is not defined. " >> $SYNOPKG_TEMP_LOGFILE
      echo "Download and install the Java Synology package from http://wp.me/pVshC-z5" >> $SYNOPKG_TEMP_LOGFILE
      exit 1
    fi

    if [ ! -f ${JAVA_HOME}/bin/java ]; then
      echo "Java is not installed or not properly configured. The Java binary could not be located. " >> $SYNOPKG_TEMP_LOGFILE
      echo "Download and install the Java Synology package from http://wp.me/pVshC-z5" >> $SYNOPKG_TEMP_LOGFILE
      exit 1
    fi

    if [ "${WIZARD_JRE_SYS}" == "true" ]; then
      JAVA_VER=`java -version 2>&1 | sed -r "/^.* version/!d;s/^.* version \"[0-9]\.([0-9]).*$/\1/"`
      if [ ${JAVA_VER} -lt 8 ]; then
        echo "This version of CrashPlan requires Java 8 or newer. Please update your Java package. "
        exit 1
      fi
    fi
  fi
}


preinst ()
{
  pre_checks
  cd ${TEMP_FOLDER}
  for WGET_URL in ${INSTALL_FILES}
  do
    WGET_FILENAME="`echo ${WGET_URL} | sed -r "s%^.*/(.*)%\1%"`"
    [ -f ${TEMP_FOLDER}/${WGET_FILENAME} ] && rm ${TEMP_FOLDER}/${WGET_FILENAME}
    wget ${WGET_URL}
    if [[ $? != 0 ]]; then
      if [ -d ${PUBLIC_FOLDER} ] && [ -f ${PUBLIC_FOLDER}/${WGET_FILENAME} ]; then
        cp ${PUBLIC_FOLDER}/${WGET_FILENAME} ${TEMP_FOLDER}
      else     
        echo "There was a problem downloading ${WGET_FILENAME} from the official download link, " >> $SYNOPKG_TEMP_LOGFILE
        echo "which was \"${WGET_URL}\" " >> $SYNOPKG_TEMP_LOGFILE
        echo "Alternatively, you may download this file manually and place it in the 'public' shared folder. " >> $SYNOPKG_TEMP_LOGFILE
        exit 1
      fi
    fi
  done
 
  exit 0
}


postinst ()
{
  if [ "${WIZARD_JRE_CP}" == "true" ]; then
    #extract Java (Web browsers love to interfere with .tar.gz files)
    cd ${PUBLIC_FOLDER}
    if [ -f ${JAVA_BINARY}.tar.gz ]; then
      #Firefox seems to be the only browser that leaves it alone
      tar xzf ${JAVA_BINARY}.tar.gz
    elif [ -f ${JAVA_BINARY}.gz ]; then
      #Chrome
      tar xzf ${JAVA_BINARY}.gz
    elif [ -f ${JAVA_BINARY}.tar ]; then
      #Safari
      tar xf ${JAVA_BINARY}.tar
    elif [ -f ${JAVA_BINARY}.tar.tar ]; then
      #Internet Explorer
      tar xzf ${JAVA_BINARY}.tar.tar
    fi
    mv ${EXTRACTED_FOLDER} ${SYNOPKG_PKGDEST}/jre-syno
    JRE_PATH="`find ${OPTDIR}/jre-syno/ -name jre`"
    [ -z ${JRE_PATH} ] && JRE_PATH=${OPTDIR}/jre-syno
    #change owner of folder tree
    chown -R root:root ${SYNOPKG_PKGDEST}
  fi
   
  #extract CPU-specific additional binaries
  mkdir ${SYNOPKG_PKGDEST}/bin
  cd ${SYNOPKG_PKGDEST}/bin
  tar xJf ${TEMP_FOLDER}/${NATIVE_BINS_FILE} && rm ${TEMP_FOLDER}/${NATIVE_BINS_FILE}
  [ "${OLD_JNA_NEEDED}" == "true" ] && tar xJf ${TEMP_FOLDER}/${OLD_JNA_FILE} && rm ${TEMP_FOLDER}/${OLD_JNA_FILE}

  #extract main archive
  cd ${TEMP_FOLDER}
  tar xzf ${TEMP_FOLDER}/${DOWNLOAD_FILE} && rm ${TEMP_FOLDER}/${DOWNLOAD_FILE} 
  
  #extract cpio archive
  cd ${SYNOPKG_PKGDEST}
  cat "${TEMP_FOLDER}/${CP_EXTRACTED_FOLDER}"/${CPI_FILE} | gzip -d -c - | ${SYNOPKG_PKGDEST}/bin/cpio -i --no-preserve-owner
  
  echo "#uncomment to expand Java max heap size beyond prescribed value (will survive upgrades)" > ${SYNOPKG_PKGDEST}/syno_package.vars
  echo "#you probably only want more than the recommended 1024M if you're backing up extremely large volumes of files" >> ${SYNOPKG_PKGDEST}/syno_package.vars
  echo "#USR_MAX_HEAP=1024M" >> ${SYNOPKG_PKGDEST}/syno_package.vars
  echo >> ${SYNOPKG_PKGDEST}/syno_package.vars

  cp ${TEMP_FOLDER}/${CP_EXTRACTED_FOLDER}/scripts/CrashPlanEngine ${OPTDIR}/bin
  cp ${TEMP_FOLDER}/${CP_EXTRACTED_FOLDER}/scripts/run.conf ${OPTDIR}/bin
  mkdir -p ${MANIFEST_FOLDER}/backupArchives    
  
  #save install variables which Crashplan expects its own installer script to create
  echo TARGETDIR=${SYNOPKG_PKGDEST} > ${VARS_FILE}
  echo BINSDIR=/bin >> ${VARS_FILE}
  echo MANIFESTDIR=${MANIFEST_FOLDER}/backupArchives >> ${VARS_FILE}
  #leave these ones out which should help upgrades from Code42 to work (based on examining an upgrade script)
  #echo INITDIR=/etc/init.d >> ${VARS_FILE}
  #echo RUNLVLDIR=/usr/syno/etc/rc.d >> ${VARS_FILE}
  echo INSTALLDATE=`date +%Y%m%d` >> ${VARS_FILE}
  [ "${WIZARD_JRE_CP}" == "true" ] && echo JAVACOMMON=${JRE_PATH}/bin/java >> ${VARS_FILE}
  [ "${WIZARD_JRE_SYS}" == "true" ] && echo JAVACOMMON=\${JAVA_HOME}/bin/java >> ${VARS_FILE}
  cat ${TEMP_FOLDER}/${CP_EXTRACTED_FOLDER}/install.defaults >> ${VARS_FILE}
  
  #remove temp files
  rm -r ${TEMP_FOLDER}/${CP_EXTRACTED_FOLDER}
  
  #add firewall config
  /usr/syno/bin/servicetool --install-configure-file --package /var/packages/${SYNOPKG_PKGNAME}/scripts/${SYNOPKG_PKGNAME}.sc > /dev/null
  
  #amend CrashPlanPROe client version
  [ "${SYNOPKG_PKGNAME}" == "CrashPlanPROe" ] && sed -i -r "s/^version=\".*(-.*$)/version=\"${CPPROE_VER}\1/" /var/packages/${SYNOPKG_PKGNAME}/INFO

  #are we transitioning an existing CrashPlan account to CrashPlan For Small Business?
  if [ "${SYNOPKG_PKGNAME}" == "CrashPlanPRO" ]; then
    if [ -e /var/packages/CrashPlan/scripts/start-stop-status ]; then
      /var/packages/CrashPlan/scripts/start-stop-status stop
      cp /var/lib/crashplan/.identity ${PUBLIC_FOLDER}/crashplan-identity.bak
      cp -R /var/packages/CrashPlan/target/conf/ ${OPTDIR}/
    fi  
  fi

  exit 0
}


preuninst ()
{
  `dirname $0`/stop-start-status stop

  exit 0
}


postuninst ()
{
  if [ -f ${SYNOPKG_PKGDEST}/syno_package.vars ]; then
    source ${SYNOPKG_PKGDEST}/syno_package.vars
  fi
  [ -e ${OPTDIR}/lib/libffi.so.5 ] && rm ${OPTDIR}/lib/libffi.so.5

  #delete symlink if it no longer resolves - PowerPC only
  if [ ! -e /lib/libffi.so.5 ]; then
    [ -L /lib/libffi.so.5 ] && rm /lib/libffi.so.5
  fi

  #remove firewall config
  if [ "${SYNOPKG_PKG_STATUS}" == "UNINSTALL" ]; then
    /usr/syno/bin/servicetool --remove-configure-file --package ${SYNOPKG_PKGNAME}.sc > /dev/null
  fi

 exit 0
}


preupgrade ()
{
  `dirname $0`/stop-start-status stop
  pre_checks
  #if identity exists back up config
  if [ -f /var/lib/crashplan/.identity ]; then
    mkdir -p ${SYNOPKG_PKGDEST}/../${SYNOPKG_PKGNAME}_data_mig/conf
    for FILE_TO_MIGRATE in ${UPGRADE_FILES}; do
      if [ -f ${OPTDIR}/${FILE_TO_MIGRATE} ]; then
        cp ${OPTDIR}/${FILE_TO_MIGRATE} ${SYNOPKG_PKGDEST}/../${SYNOPKG_PKGNAME}_data_mig/${FILE_TO_MIGRATE}
      fi
    done
    for FOLDER_TO_MIGRATE in ${UPGRADE_FOLDERS}; do
      if [ -d ${OPTDIR}/${FOLDER_TO_MIGRATE} ]; then
        mv ${OPTDIR}/${FOLDER_TO_MIGRATE} ${SYNOPKG_PKGDEST}/../${SYNOPKG_PKGNAME}_data_mig
      fi
    done
  fi

  exit 0
}


postupgrade ()
{
  #use the migrated identity and config data from the previous version
  if [ -f ${SYNOPKG_PKGDEST}/../${SYNOPKG_PKGNAME}_data_mig/conf/my.service.xml ]; then
    for FILE_TO_MIGRATE in ${UPGRADE_FILES}; do
      if [ -f ${SYNOPKG_PKGDEST}/../${SYNOPKG_PKGNAME}_data_mig/${FILE_TO_MIGRATE} ]; then
        mv ${SYNOPKG_PKGDEST}/../${SYNOPKG_PKGNAME}_data_mig/${FILE_TO_MIGRATE} ${OPTDIR}/${FILE_TO_MIGRATE}
      fi
    done
    for FOLDER_TO_MIGRATE in ${UPGRADE_FOLDERS}; do
    if [ -d ${SYNOPKG_PKGDEST}/../${SYNOPKG_PKGNAME}_data_mig/${FOLDER_TO_MIGRATE} ]; then
      mv ${SYNOPKG_PKGDEST}/../${SYNOPKG_PKGNAME}_data_mig/${FOLDER_TO_MIGRATE} ${OPTDIR}
    fi
    done
    rmdir ${SYNOPKG_PKGDEST}/../${SYNOPKG_PKGNAME}_data_mig/conf
    rmdir ${SYNOPKG_PKGDEST}/../${SYNOPKG_PKGNAME}_data_mig
    
    #make CrashPlan log entry
    TIMESTAMP="`date "+%D %I:%M%p"`"
    echo "I ${TIMESTAMP} Synology Package Center updated ${SYNOPKG_PKGNAME} to version ${SYNOPKG_PKGVER}" >> ${LOG_FILE}
  fi
  
  exit 0
}
 

start-stop-status.sh

#!/bin/sh

#--------CRASHPLAN start-stop-status script
#--------package maintained at pcloadletter.co.uk


TEMP_FOLDER="`find / -maxdepth 2 -path '/volume?/@tmp' | head -n 1`"
MANIFEST_FOLDER="/`echo $TEMP_FOLDER | cut -f2 -d'/'`/crashplan" 
ENGINE_CFG="run.conf"
PKG_FOLDER="`dirname $0 | cut -f1-4 -d'/'`"
DNAME="`dirname $0 | cut -f4 -d'/'`"
OPTDIR="${PKG_FOLDER}/target"
PID_FILE="${OPTDIR}/${DNAME}.pid"
DLOG="${OPTDIR}/log/history.log.0"
CFG_PARAM="SRV_JAVA_OPTS"
JAVA_MIN_HEAP=`grep "^${CFG_PARAM}=" "${OPTDIR}/bin/${ENGINE_CFG}" | sed -r "s/^.*-Xms([0-9]+)[Mm] .*$/\1/"` 
SYNO_CPU_ARCH="`uname -m`"
TIMESTAMP="`date "+%D %I:%M%p"`"
FULL_CP="${OPTDIR}/lib/com.backup42.desktop.jar:${OPTDIR}/lang"
source ${OPTDIR}/install.vars
source /etc/profile
source /root/.profile


start_daemon ()
{
  #check persistent variables from syno_package.vars
  USR_MAX_HEAP=0
  if [ -f ${OPTDIR}/syno_package.vars ]; then
    source ${OPTDIR}/syno_package.vars
  fi
  USR_MAX_HEAP=`echo $USR_MAX_HEAP | sed -e "s/[mM]//"`

  #do we need to restore the identity file - has a DSM upgrade scrubbed /var/lib/crashplan?
  if [ ! -e /var/lib/crashplan ]; then
    mkdir /var/lib/crashplan
    [ -e ${OPTDIR}/conf/var-backup/.identity ] && cp ${OPTDIR}/conf/var-backup/.identity /var/lib/crashplan/
  fi

  #fix up some of the binary paths and fix some command syntax for busybox 
  #moved this to start-stop-status.sh from installer.sh because Code42 push updates and these
  #new scripts will need this treatment too
  find ${OPTDIR}/ -name "*.sh" | while IFS="" read -r FILE_TO_EDIT; do
    if [ -e ${FILE_TO_EDIT} ]; then
      #this list of substitutions will probably need expanding as new CrashPlan updates are released
      sed -i "s%^#!/bin/bash%#!$/bin/sh%" "${FILE_TO_EDIT}"
      sed -i -r "s%(^\s*)(/bin/cpio |cpio ) %\1/${OPTDIR}/bin/cpio %" "${FILE_TO_EDIT}"
      sed -i -r "s%(^\s*)(/bin/ps|ps) [^w][^\|]*\|%\1/bin/ps w \|%" "${FILE_TO_EDIT}"
      sed -i -r "s%\`ps [^w][^\|]*\|%\`ps w \|%" "${FILE_TO_EDIT}"
      sed -i -r "s%^ps [^w][^\|]*\|%ps w \|%" "${FILE_TO_EDIT}"
      sed -i "s/rm -fv/rm -f/" "${FILE_TO_EDIT}"
      sed -i "s/mv -fv/mv -f/" "${FILE_TO_EDIT}"
    fi
  done

  #use this daemon init script rather than the unreliable Code42 stock one which greps the ps output
  sed -i "s%^ENGINE_SCRIPT=.*$%ENGINE_SCRIPT=$0%" ${OPTDIR}/bin/restartLinux.sh

  #any downloaded upgrade script will usually have failed despite the above changes
  #so ignore the script and explicitly extract the new java code using the chrisnelson.ca method 
  #thanks to Jeff Bingham for tweaks 
  UPGRADE_JAR=`find ${OPTDIR}/upgrade -maxdepth 1 -name "*.jar" | tail -1`
  if [ -n "${UPGRADE_JAR}" ]; then
    rm ${OPTDIR}/*.pid > /dev/null
 
    #make CrashPlan log entry
    echo "I ${TIMESTAMP} Synology extracting upgrade from ${UPGRADE_JAR}" >> ${DLOG}

    UPGRADE_VER=`echo ${SCRIPT_HOME} | sed -r "s/^.*\/([0-9_]+)\.[0-9]+/\1/"`
    #DSM 6.0 no longer includes unzip, use 7z instead
    unzip -o ${OPTDIR}/upgrade/${UPGRADE_VER}.jar "*.jar" -d ${OPTDIR}/lib/ || 7z e -y ${OPTDIR}/upgrade/${UPGRADE_VER}.jar "*.jar" -o${OPTDIR}/lib/ > /dev/null
    unzip -o ${OPTDIR}/upgrade/${UPGRADE_VER}.jar "lang/*" -d ${OPTDIR} || 7z e -y ${OPTDIR}/upgrade/${UPGRADE_VER}.jar "lang/*" -o${OPTDIR} > /dev/null
    mv ${UPGRADE_JAR} ${TEMP_FOLDER}/ > /dev/null
    exec $0
  fi

  #updates may also overwrite our native binaries
  [ -e ${OPTDIR}/bin/libffi.so.5 ] && cp -f ${OPTDIR}/bin/libffi.so.5 ${OPTDIR}/lib/
  [ -e ${OPTDIR}/bin/libjtux.so ] && cp -f ${OPTDIR}/bin/libjtux.so ${OPTDIR}/
  [ -e ${OPTDIR}/bin/jna-3.2.5.jar ] && cp -f ${OPTDIR}/bin/jna-3.2.5.jar ${OPTDIR}/lib/
  if [ -e ${OPTDIR}/bin/jna.jar ] && [ -e ${OPTDIR}/lib/jna.jar ]; then
    cp -f ${OPTDIR}/bin/jna.jar ${OPTDIR}/lib/
  fi

  #create or repair libffi.so.5 symlink if a DSM upgrade has removed it - PowerPC only
  if [ -e ${OPTDIR}/lib/libffi.so.5 ]; then
    if [ ! -e /lib/libffi.so.5 ]; then
      #if it doesn't exist, but is still a link then it's a broken link and should be deleted first
      [ -L /lib/libffi.so.5 ] && rm /lib/libffi.so.5
      ln -s ${OPTDIR}/lib/libffi.so.5 /lib/libffi.so.5
    fi
  fi

  #set appropriate Java max heap size
  RAM=$((`free | grep Mem: | sed -e "s/^ *Mem: *\([0-9]*\).*$/\1/"`/1024))
  if [ $RAM -le 128 ]; then
    JAVA_MAX_HEAP=80
  elif [ $RAM -le 256 ]; then
    JAVA_MAX_HEAP=192
  elif [ $RAM -le 512 ]; then
    JAVA_MAX_HEAP=384
  elif [ $RAM -le 1024 ]; then
    JAVA_MAX_HEAP=512
  elif [ $RAM -gt 1024 ]; then
    JAVA_MAX_HEAP=1024
  fi
  if [ $USR_MAX_HEAP -gt $JAVA_MAX_HEAP ]; then
    JAVA_MAX_HEAP=${USR_MAX_HEAP}
  fi   
  if [ $JAVA_MAX_HEAP -lt $JAVA_MIN_HEAP ]; then
    #can't have a max heap lower than min heap (ARM low RAM systems)
    $JAVA_MAX_HEAP=$JAVA_MIN_HEAP
  fi
  sed -i -r "s/(^${CFG_PARAM}=.*) -Xmx[0-9]+[mM] (.*$)/\1 -Xmx${JAVA_MAX_HEAP}m \2/" "${OPTDIR}/bin/${ENGINE_CFG}"
  
  #disable the use of the x86-optimized external Fast MD5 library if running on ARM and PPC CPUs
  #seems to be the default behaviour now but that may change again
  [ "${SYNO_CPU_ARCH}" == "x86_64" ] && SYNO_CPU_ARCH="i686"
  if [ "${SYNO_CPU_ARCH}" != "i686" ]; then
    grep "^${CFG_PARAM}=.*c42\.native\.md5\.enabled" "${OPTDIR}/bin/${ENGINE_CFG}" > /dev/null \
     || sed -i -r "s/(^${CFG_PARAM}=\".*)\"$/\1 -Dc42.native.md5.enabled=false\"/" "${OPTDIR}/bin/${ENGINE_CFG}"
  fi

  #move the Java temp directory from the default of /tmp
  grep "^${CFG_PARAM}=.*Djava\.io\.tmpdir" "${OPTDIR}/bin/${ENGINE_CFG}" > /dev/null \
   || sed -i -r "s%(^${CFG_PARAM}=\".*)\"$%\1 -Djava.io.tmpdir=${TEMP_FOLDER}\"%" "${OPTDIR}/bin/${ENGINE_CFG}"

  #now edit the XML config file, which only exists after first run
  if [ -f ${OPTDIR}/conf/my.service.xml ]; then

    #allow direct connections from CrashPlan Desktop client on remote systems
    #you must edit the value of serviceHost in conf/ui.properties on the client you connect with
    #users report that this value is sometimes reset so now it's set every service startup 
    sed -i "s/<serviceHost>127\.0\.0\.1<\/serviceHost>/<serviceHost>0\.0\.0\.0<\/serviceHost>/" "${OPTDIR}/conf/my.service.xml"
    #default changed in CrashPlan 4.3
    sed -i "s/<serviceHost>localhost<\/serviceHost>/<serviceHost>0\.0\.0\.0<\/serviceHost>/" "${OPTDIR}/conf/my.service.xml"
    #since CrashPlan 4.4 another config file to allow remote console connections
    sed -i "s/127\.0\.0\.1/0\.0\.0\.0/" /var/lib/crashplan/.ui_info
     
    #this change is made only once in case you want to customize the friends' backup location
    if [ "${MANIFEST_PATH_SET}" != "True" ]; then

      #keep friends' backup data outside the application folder to make accidental deletion less likely 
      sed -i "s%<manifestPath>.*</manifestPath>%<manifestPath>${MANIFEST_FOLDER}/backupArchives/</manifestPath>%" "${OPTDIR}/conf/my.service.xml"
      echo "MANIFEST_PATH_SET=True" >> ${OPTDIR}/syno_package.vars
    fi

    #since CrashPlan version 3.5.3 the value javaMemoryHeapMax also needs setting to match that used in bin/run.conf
    sed -i -r "s%(<javaMemoryHeapMax>)[0-9]+[mM](</javaMemoryHeapMax>)%\1${JAVA_MAX_HEAP}m\2%" "${OPTDIR}/conf/my.service.xml"

    #make sure CrashPlan is not binding to the IPv6 stack
    grep "\-Djava\.net\.preferIPv4Stack=true" "${OPTDIR}/bin/${ENGINE_CFG}" > /dev/null \
     || sed -i -r "s/(^${CFG_PARAM}=\".*)\"$/\1 -Djava.net.preferIPv4Stack=true\"/" "${OPTDIR}/bin/${ENGINE_CFG}"
   else
    echo "Check the package log to ensure the package has started successfully, then stop and restart the package to allow desktop client connections." > "${SYNOPKG_TEMP_LOGFILE}"
  fi

  #increase the system-wide maximum number of open files from Synology default of 24466
  [ `cat /proc/sys/fs/file-max` -lt 65536 ] && echo "65536" > /proc/sys/fs/file-max

  #raise the maximum open file count from the Synology default of 1024 - thanks Casper K. for figuring this out
  #http://support.code42.com/Administrator/3.6_And_4.0/Troubleshooting/Too_Many_Open_Files
  ulimit -n 65536

  #ensure that Code 42 have not amended install.vars to force the use of their own (Intel) JRE
  if [ -e ${OPTDIR}/jre-syno ]; then
    JRE_PATH="`find ${OPTDIR}/jre-syno/ -name jre`"
    [ -z ${JRE_PATH} ] && JRE_PATH=${OPTDIR}/jre-syno
    sed -i -r "s|^(JAVACOMMON=).*$|\1\${JRE_PATH}/bin/java|" ${OPTDIR}/install.vars
    
    #if missing, set timezone and locale for dedicated JRE   
    if [ -z ${TZ} ]; then
      SYNO_TZ=`cat /etc/synoinfo.conf | grep timezone | cut -f2 -d'"'`
      #fix for DST time in DSM 5.2 thanks to MinimServer Syno package author
      [ -e /usr/share/zoneinfo/Timezone/synotztable.json ] \
       && SYNO_TZ=`jq ".${SYNO_TZ} | .nameInTZDB" /usr/share/zoneinfo/Timezone/synotztable.json | sed -e "s/\"//g"` \
       || SYNO_TZ=`grep "^${SYNO_TZ}" /usr/share/zoneinfo/Timezone/tzname | sed -e "s/^.*= //"`
      export TZ=${SYNO_TZ}
    fi
    [ -z ${LANG} ] && export LANG=en_US.utf8
    export CLASSPATH=.:${OPTDIR}/jre-syno/lib

  else
    sed -i -r "s|^(JAVACOMMON=).*$|\1\${JAVA_HOME}/bin/java|" ${OPTDIR}/install.vars
  fi

  source ${OPTDIR}/bin/run.conf
  source ${OPTDIR}/install.vars
  cd ${OPTDIR}
  $JAVACOMMON $SRV_JAVA_OPTS -classpath $FULL_CP com.backup42.service.CPService > ${OPTDIR}/log/engine_output.log 2> ${OPTDIR}/log/engine_error.log &
  if [ $! -gt 0 ]; then
    echo $! > $PID_FILE
    renice 19 $! > /dev/null
    if [ -z "${SYNOPKG_PKGDEST}" ]; then
      #script was manually invoked, need this to show status change in Package Center      
      [ -e ${PKG_FOLDER}/enabled ] || touch ${PKG_FOLDER}/enabled
    fi
  else
    echo "${DNAME} failed to start, check ${OPTDIR}/log/engine_error.log" > "${SYNOPKG_TEMP_LOGFILE}"
    echo "${DNAME} failed to start, check ${OPTDIR}/log/engine_error.log" >&2
    exit 1
  fi
}

stop_daemon ()
{
  echo "I ${TIMESTAMP} Stopping ${DNAME}" >> ${DLOG}
  kill `cat ${PID_FILE}`
  wait_for_status 1 20 || kill -9 `cat ${PID_FILE}`
  rm -f ${PID_FILE}
  if [ -z ${SYNOPKG_PKGDEST} ]; then
    #script was manually invoked, need this to show status change in Package Center
    [ -e ${PKG_FOLDER}/enabled ] && rm ${PKG_FOLDER}/enabled
  fi
  #backup identity file in case DSM upgrade removes it
  [ -e ${OPTDIR}/conf/var-backup ] || mkdir ${OPTDIR}/conf/var-backup 
  cp /var/lib/crashplan/.identity ${OPTDIR}/conf/var-backup/
}

daemon_status ()
{
  if [ -f ${PID_FILE} ] && kill -0 `cat ${PID_FILE}` > /dev/null 2>&1; then
    return
  fi
  rm -f ${PID_FILE}
  return 1
}

wait_for_status ()
{
  counter=$2
  while [ ${counter} -gt 0 ]; do
    daemon_status
    [ $? -eq $1 ] && return
    let counter=counter-1
    sleep 1
  done
  return 1
}


case $1 in
  start)
    if daemon_status; then
      echo ${DNAME} is already running with PID `cat ${PID_FILE}`
      exit 0
    else
      echo Starting ${DNAME} ...
      start_daemon
      exit $?
    fi
  ;;

  stop)
    if daemon_status; then
      echo Stopping ${DNAME} ...
      stop_daemon
      exit $?
    else
      echo ${DNAME} is not running
      exit 0
    fi
  ;;

  restart)
    stop_daemon
    start_daemon
    exit $?
  ;;

  status)
    if daemon_status; then
      echo ${DNAME} is running with PID `cat ${PID_FILE}`
      exit 0
    else
      echo ${DNAME} is not running
      exit 1
    fi
  ;;

  log)
    echo "${DLOG}"
    exit 0
  ;;

  *)
    echo "Usage: $0 {start|stop|status|restart}" >&2
    exit 1
  ;;

esac
 

install_uifile & upgrade_uifile

[
  {
    "step_title": "Client Version Selection",
    "items": [
      {
        "type": "singleselect",
        "desc": "Please select the CrashPlanPROe client version that is appropriate for your backup destination server:",
        "subitems": [
          {
            "key": "WIZARD_VER_483",
            "desc": "4.8.3",
            "defaultValue": true
          },          {
            "key": "WIZARD_VER_480",
            "desc": "4.8.0",
            "defaultValue": false
          },
          {
            "key": "WIZARD_VER_470",
            "desc": "4.7.0",
            "defaultValue": false
          },
          {
            "key": "WIZARD_VER_460",
            "desc": "4.6.0",
            "defaultValue": false
          },
          {
            "key": "WIZARD_VER_452",
            "desc": "4.5.2",
            "defaultValue": false
          },
          {
            "key": "WIZARD_VER_450",
            "desc": "4.5.0",
            "defaultValue": false
          },
          {
            "key": "WIZARD_VER_441",
            "desc": "4.4.1",
            "defaultValue": false
          },
          {
            "key": "WIZARD_VER_430",
            "desc": "4.3.0",
            "defaultValue": false
          },
          {
            "key": "WIZARD_VER_420",
            "desc": "4.2.0",
            "defaultValue": false
          },
          {
            "key": "WIZARD_VER_370",
            "desc": "3.7.0",
            "defaultValue": false
          },
          {
            "key": "WIZARD_VER_364",
            "desc": "3.6.4",
            "defaultValue": false
          },
          {
            "key": "WIZARD_VER_363",
            "desc": "3.6.3",
            "defaultValue": false
          },
          {
            "key": "WIZARD_VER_3614",
            "desc": "3.6.1.4",
            "defaultValue": false
          },
          {
            "key": "WIZARD_VER_353",
            "desc": "3.5.3",
            "defaultValue": false
          },
          {
            "key": "WIZARD_VER_341",
            "desc": "3.4.1",
            "defaultValue": false
          },
          {
            "key": "WIZARD_VER_33",
            "desc": "3.3",
            "defaultValue": false
          }
        ]
      }
    ]
  },
  {
    "step_title": "Java Runtime Environment Selection",
    "items": [
      {
        "type": "singleselect",
        "desc": "Please select the Java version which you would like CrashPlan to use:",
        "subitems": [
          {
            "key": "WIZARD_JRE_SYS",
            "desc": "Default system Java version",
            "defaultValue": false
          },
          {
            "key": "WIZARD_JRE_CP",
            "desc": "Dedicated installation of Java 8",
            "defaultValue": true
          }
        ]
      }
    ]
  }
]
 

Changelog:

  • 0031 Added TCP 4242 to the firewall services (computer to computer connections)
  • 0047 30/Oct/17 – Updated dedicated Java version to 8 update 151, added support for additional Intel CPUs in x18 Synology products.
  • 0046 26/Aug/17 – Updated to CrashPlan PRO 4.9, added support for migration from CrashPlan For Home to CrashPlan For Small Business (CrashPlan PRO). Please read the Migration section on this page for instructions.
  • 0045 02/Aug/17 – Updated to CrashPlan 4.8.3, updated dedicated Java version to 8 update 144
  • 0044 21/Jan/17 – Updated dedicated Java version to 8 update 121
  • 0043 07/Jan/17 – Updated dedicated Java version to 8 update 111, added support for Intel Broadwell and Grantley CPUs
  • 0042 03/Oct/16 – Updated to CrashPlan 4.8.0, Java 8 is now required, added optional dedicated Java 8 Runtime instead of the default system one including 64bit Java support on 64 bit Intel CPUs to permit memory allocation larger than 4GB. Support for non-Intel platforms withdrawn owing to Code42’s reliance on proprietary native code library libc42archive.so
  • 0041 20/Jul/16 – Improved auto-upgrade compatibility (hopefully), added option to have CrashPlan use a dedicated Java 7 Runtime instead of the default system one, including 64bit Java support on 64 bit Intel CPUs to permit memory allocation larger than 4GB
  • 0040 25/May/16 – Added cpio to the path in the running context of start-stop-status.sh
  • 0039 25/May/16 – Updated to CrashPlan 4.7.0, at each launch forced the use of the system JRE over the CrashPlan bundled Intel one, added Maven build of JNA 4.1.0 for ARMv7 systems consistent with the version bundled with CrashPlan
  • 0038 27/Apr/16 – Updated to CrashPlan 4.6.0, and improved support for Code 42 pushed updates
  • 0037 21/Jan/16 – Updated to CrashPlan 4.5.2
  • 0036 14/Dec/15 – Updated to CrashPlan 4.5.0, separate firewall definitions for management client and for friends backup, added support for DS716+ and DS216play
  • 0035 06/Nov/15 – Fixed the update to 4.4.1_59, new installs now listen for remote connections after second startup (was broken from 4.4), updated client install documentation with more file locations and added a link to a new Code42 support doc
    EITHER completely remove and reinstall the package (which will require a rescan of the entire backup set) OR alternatively please delete all except for one of the failed upgrade numbered subfolders in /var/packages/CrashPlan/target/upgrade before upgrading. There will be one folder for each time CrashPlan tried and failed to start since Code42 pushed the update
  • 0034 04/Oct/15 – Updated to CrashPlan 4.4.1, bundled newer JNA native libraries to match those from Code42, PLEASE READ UPDATED BLOG POST INSTRUCTIONS FOR CLIENT INSTALL this version introduced yet another requirement for the client
  • 0033 12/Aug/15 – Fixed version 0032 client connection issue for fresh installs
  • 0032 12/Jul/15 – Updated to CrashPlan 4.3, PLEASE READ UPDATED BLOG POST INSTRUCTIONS FOR CLIENT INSTALL this version introduced an extra requirement, changed update repair to use the chrisnelson.ca method, forced CrashPlan to prefer IPv4 over IPv6 bindings, removed some legacy version migration scripting, updated main blog post documentation
  • 0031 20/May/15 – Updated to CrashPlan 4.2, cross compiled a newer cpio binary for some architectures which were segfaulting while unpacking main CrashPlan archive, added port 4242 to the firewall definition (friend backups), package is now signed with repository private key
  • 0030 16/Feb/15 – Fixed show-stopping issue with version 0029 for systems with more than one volume
  • 0029 21/Jan/15 – Updated to CrashPlan version 3.7.0, improved detection of temp folder (prevent use of /var/@tmp), added support for Annapurna Alpine AL514 CPU (armhf) in DS2015xs, added support for Marvell Armada 375 CPU (armhf) in DS215j, abandoned practical efforts to try to support Code42’s upgrade scripts, abandoned inotify support (realtime backup) on PowerPC after many failed attempts with self-built and pre-built jtux and jna libraries, back-merged older libffi support for old PowerPC binaries after it was removed in 0028 re-write
  • 0028 22/Oct/14 – Substantial re-write:
    Updated to CrashPlan version 3.6.4
    DSM 5.0 or newer is now required
    libjnidispatch.so taken from Debian JNA 3.2.7 package with dependency on newer libffi.so.6 (included in DSM 5.0)
    jna-3.2.5.jar emptied of irrelevant CPU architecture libs to reduce size
    Increased default max heap size from 512MB to 1GB on systems with more than 1GB RAM
    Intel CPUs no longer need the awkward glibc version-faking shim to enable inotify support (for real-time backup)
    Switched to using root account – no more adding account permissions for backup, package upgrades will no longer break this
    DSM Firewall application definition added
    Tested with DSM Task Scheduler to allow backups between certain times of day only, saving RAM when not in use
    Daemon init script now uses a proper PID file instead of Code42’s unreliable method of using grep on the output of ps
    Daemon init script can be run from the command line
    Removal of bash binary dependency now Code42’s CrashPlanEngine script is no longer used
    Removal of nice binary dependency, using BusyBox equivalent renice
    Unified ARMv5 and ARMv7 external binary package (armle)
    Added support for Mindspeed Comcerto 2000 CPU (comcerto2k – armhf) in DS414j
    Added support for Intel Atom C2538 (avoton) CPU in DS415+
    Added support to choose which version of CrashPlan PROe client to download, since some servers may still require legacy versions
    Switched to .tar.xz compression for native binaries to reduce web hosting footprint
  • 0027 20/Mar/14 – Fixed open file handle limit for very large backup sets (ulimit fix)
  • 0026 16/Feb/14 – Updated all CrashPlan clients to version 3.6.3, improved handling of Java temp files
  • 0025 30/Jan/14 – glibc version shim no longer used on Intel Synology models running DSM 5.0
  • 0024 30/Jan/14 – Updated to CrashPlan PROe 3.6.1.4 and added support for PowerPC 2010 Synology models running DSM 5.0
  • 0023 30/Jan/14 – Added support for Intel Atom Evansport and Armada XP CPUs in new DSx14 products
  • 0022 10/Jun/13 – Updated all CrashPlan client versions to 3.5.3, compiled native binary dependencies to add support for Armada 370 CPU (DS213j), start-stop-status.sh now updates the new javaMemoryHeapMax value in my.service.xml to the value defined in syno_package.vars
  • 0021 01/Mar/13 – Updated CrashPlan to version 3.5.2
  • 0020 21/Jan/13 – Fixes for DSM 4.2
  • 018 Updated CrashPlan PRO to version 3.4.1
  • 017 Updated CrashPlan and CrashPlan PROe to version 3.4.1, and improved in-app update handling
  • 016 Added support for Freescale QorIQ CPUs in some x13 series Synology models, and installer script now downloads native binaries separately to reduce repo hosting bandwidth, PowerQUICC PowerPC processors in previous Synology generations with older glibc versions are not supported
  • 015 Added support for easy scheduling via cron – see updated Notes section
  • 014 DSM 4.1 user profile permissions fix
  • 013 implemented update handling for future automatic updates from Code 42, and incremented CrashPlanPRO client to release version 3.2.1
  • 012 incremented CrashPlanPROe client to release version 3.3
  • 011 minor fix to allow a wildcard on the cpio archive name inside the main installer package (to fix CP PROe client since Code 42 Software had amended the cpio file version to 3.2.1.2)
  • 010 minor bug fix relating to daemon home directory path
  • 009 rewrote the scripts to be even easier to maintain and unified as much as possible with my imminent CrashPlan PROe server package, fixed a timezone bug (tightened regex matching), moved the script-amending logic from installer.sh to start-stop-status.sh with it now applying to all .sh scripts each startup so perhaps updates from Code42 might work in future, if wget fails to fetch the installer from Code42 the installer will look for the file in the public shared folder
  • 008 merged the 14 package scripts each (7 for ARM, 7 for Intel) for CP, CP PRO, & CP PROe – 42 scripts in total – down to just two! ARM & Intel are now supported by the same package, Intel synos now have working inotify support (Real-Time Backup) thanks to rwojo’s shim to pass the glibc version check, upgrade process now retains login, cache and log data (no more re-scanning), users can specify a persistent larger max heap size for very large backup sets
  • 007 fixed a bug that broke CrashPlan if the Java folder moved (if you changed version)
  • 006 installation now fails without User Home service enabled, fixed Daylight Saving Time support, automated replacing the ARM libffi.so symlink which is destroyed by DSM upgrades, stopped assuming the primary storage volume is /volume1, reset ownership on /var/lib/crashplan and the Friends backup location after installs and upgrades
  • 005 added warning to restart daemon after 1st run, and improved upgrade process again
  • 004 updated to CrashPlan 3.2.1 and improved package upgrade process, forced binding to 0.0.0.0 each startup
  • 003 fixed ownership of /volume1/crashplan folder
  • 002 updated to CrashPlan 3.2
  • 001 30/Jan/12 – intial public release
 
 

6,692 thoughts on “CrashPlan packages for Synology NAS

    1. Joerg W.'s avatarJoerg W.

      These are container-files. Big files – mine are 1TB each! But inside the 3TB-Volume are only a couple of GB. So it would take ages to upload and keep them updated. It makes no sense to backup whole iSCSI-Volumes. Even you could mount it read-only from within the synology – chances are, you would have a volume that is not understood by the synology. In my case, it would be HFS+.

      Reply
  1. davidyaentropy's avatardavidyaentropy

    Thanks for this package. Installation works on my Synology DS412+.
    Now, CrashPlan updated to 3.5.3 (UI on the PC) but on the NAS it is still 3.5.2 and backup is not working anymore. System seems to be locked. CrashPlan wants to update in loop… Locally (PC) but the package on NAS remain 3.5.2. On the welcome screen of UI I’ve a ‘impossible to connect to the remote engine continue YES | NO ’
    Is there any update of the Linux package on the NAS to come from you side ?
    Or any help to patch this issue will be appreciated.
    Best, David / France

    Reply
    1. Joerg W.'s avatarJoerg W.

      You did follow the “Stop/Start-procedere after an update”-advice above?
      “When CrashPlan downloads and attempts to run an automatic update, the script will most likely fail and stop the package. This is typically caused by syntax differences with the Synology versions of certain Linux shell commands (like rm, mv, or ps). You will need to wait several minutes in the event of this happening before you take action, because the update script tries to restart CrashPlan 10 times at 10 second intervals. After this, you simply start the package again in Package Center and my scripts will fix the update, then run it. One final package restart is required before you can connect with the CrashPlan Desktop client (remember to update that too).”

      Reply
      1. davidyaentropy's avatardavidyaentropy

        Thank you for the fast reply. The backup is now working. However I still have CrashPlan 3.5.2-0021 installed on my NAS and (CrashPlan desktop 3.5.3 on Windows 7.).
        How can I update the linux engine to 3.5.3 ?
        Please see detailed screenshots here: http://xdatacenter.net/tmp/cp/
        Remark, I only have Java SE Embedded 6 available has a package. (not Java SE Embedded 7) don’t know if it can be a source of problem?
        Thanks again for your help.

      2. patters's avatarpatters Post author

        The package version displayed in DSM Package Centre will not update when an in-app update happens. To see for sure which version your NAS is running, use the CP client on your computer to manage the NAS as usual, then double click on the CrashPlan house logo in the corner. In the prompt, type ‘version’.

  2. A. Fowler's avatarA. Fowler

    Just gave you a donation for your excellent work on this project. Have you ever considered accepting Bitcoin? (hint, hint)

    A couple of constructive comments that might help others.

    Although some consider it unsafe to run services as root unless absolutely necessary, I found it necessary. I keep a number of restricted-access files on my Synology, and CrashPlan running as user ‘crashplan’ would never back them up because it could not read them. I also for various reasons could not simply add them to the crashplan group. I ended up hacking the install to run CrashPlan as root, and now it happily backs up all my files. However if you have any other workaround for this, I’d be glad to hear it.

    If anyone else wants to run it as root (including myself if I forget how I did this, which happens often), here are some steps and some gotchas.

    Modify /var/packages/CrashPlan/scripts/start-stop-status.sh. Around line 160 in my file, it tests for the architecture before launching. I am using an Intel-based Synology, so architecture is x86_64. Thus, the line that launches CrashPlan is the next line (161 in my file). I commented out that line, and by experimentation and debugging and trial-and-error, I found these lines work:
    export HOME=’/var/services/homes/crashplan’
    export JAVA_HOME=’/volume1/@appstore/java6/jre’
    /bin/sh -c “LD_PRELOAD=${SYNOPKG_PKGDEST}/lib/synology-x86-glibc-2.4-shim.so ${OPTDIR}/bin/${ENGINE_SCRIPT} start”

    [… I have a feeling I’m already leaving something out…]

    Gotcha: When running as root, CrashPlan will write its identity file to /var/lib/crashplan/.identity, which it could not do previously. Then, as you noted above (and which I was happy to find when trying to debug this), it gets confused between that file and the one it wrote previously as the ‘crashplan’ user in /var/services/homes/crashplan/.crashplan/.identity. Solution: delete the latter file, and then re-adopt the computer.

    Reply
  3. A. Fowler's avatarA. Fowler

    [Continuing the post on running crashplan as root] I did forget the section on stopping Crashplan. It is similar. Comment out the ‘su – …’ line and add three lines as shown below:

    # su – ${DAEMON_USER} -s /bin/sh -c “${OPTDIR}/bin/${ENGINE_SCRIPT} stop”
    export HOME=’/var/services/homes/crashplan’
    export JAVA_HOME=’/volume1/@appstore/java6/jre’
    ${OPTDIR}/bin/${ENGINE_SCRIPT} stop

    Reply
  4. reid's avatarreid

    Hi – thanks so much for this. Got it installed a few months ago and it was working wonderfully until recently and I can’t seem to figure out what broke/how to fix it. I’m running the 3.5.3 client on a Mac (it updates itself automatically I believe) and 3.5.2 on my DS1811+ and the main two issues are:

    1. it seems to “forget” what it is supposed to back up. I have trimmed it down to only 2 folders in my testing but when I fire up the client it immediately starts “scanning…” as though it doesn’t know what it should be doing. When I get the emailed status report from Crashplan it indicates that I am trying to back up 145GB when in fact I have about 1.5TB selected in the headless client.
    2. the client will usually crash after a few minutes saying that it was “disconnected from the backup engine.”

    It’s frustrating because it is still backing up small bits of what I have selected at the scheduled times but I already had backed up about 850GB and am worried that I may lose all of that data on the CP servers.

    thanks for any advice – happy to dig up log files or whatever helps.

    Cheers,
    Reid

    Reply
    1. Joerg W.'s avatarJoerg W.

      That sounds like your headless client on the NAS does not have enough RAM to work with. On my 1812+ it has been modified to use up to 2.5GB and is happily running along now with several TB as backup Source and several incoming backups. Check some older comments for explanations how to change the amount of RAM dedicated to CrashPlan/Java.

      Reply
  5. William W's avatarWilliam W

    Will you be able to support the new DS213j at some time in the future? It runs the Marvell_ARMADA_370 so I dont get the option for Crashplan in your package.
    Majorly bummed after buying my DS213j to _then_ find it wont run your headless Crashplan :(
    The 213 a great starter unit, will be very popular because of the price point.
    Love your work, genius.

    Reply
    1. patters's avatarpatters Post author

      I’ve tried to compile the various dependencies for the Armada 370 CPU but I have no way of testing them unfortunately. Can you try installing this on your DS213j via Package Center:
      http://packages.pcloadletter.co.uk/downloads/crashplan3.5.3-merged-0022.spk

      Does CrashPlan start? Can you check the log files in an SSH session:
      cat /volume1/@appstore/CrashPlan/log/engine_error.log | more
      cat /volume1/@appstore/CrashPlan/log/engine_output.log | more

      If it runs, can you check that it is able to detect real-time changes to the filesystem? Does it list another file to be backed up immediately in the CrashPlan console when you add a new file to a monitored folder?

      Reply
      1. iamroddo's avatariamroddo

        I installed the package manually and adopted an account (Crashplan+) that was running elsewhere. Unfortunatately the service crashes quite frequently (every few minutes). I have about 160GB to backup. According to the specs the 213j has 512MB of RAM. Is this not enough? If not then am I sol? Could a cron script to restart it help?

        BTW Do you still need someone to provide feedback on the Serviio package on the 213j?

      2. John B's avatarJohn B

        @iamroddo

        512MB does not sound like much.
        What do the logs say, that can help you shed some light on the issue?

  6. hal sandick's avatarhal sandick

    First, Thanks!

    I’m running this package on my s213+. The package updated to 3.5.3 on the ds213+ but, the program on my windows 7 machine is still at 3.5.2. Everything is working fine. Nonetheless, should I update the windows program to 3.5.3? I only use the windows program to interface with the ds213+, ie, I don’t use the program to backup my windows machine.

    thanks again.

    Hal

    Reply
  7. Mike's avatarMike

    I also used to have big problems to get CrashPlan to work on my DS 411 + II, but after increasing Heap Size to 1024 Mb and set the start / stop using Cronjob Editor everything has worked 100%. One month without any problems what so ever.

    Thanks for a great package!

    Reply
  8. Pingback: Synology DiskStation Network Attached Storage (NAS) | Ben Black's Blog

  9. Pingback: My Family’s PC/Mac Backup Strategy | Ben Black's Blog

  10. Mauro's avatarMauro

    Hi,
    after the increasing of virtual memory CrashPlan works fine until sunday. In the last days it stops few minutes after the full scanning of 3:00AM and after few files backed up. The engine_error.log is empty. I inspected the others log files but I didn’t found anything that seems to be an error message.
    When I restart the engine via the http interface (Packages Center) it starts and it seems to work fine.
    Any idea? Maybe I can send you sole log files?
    Thank you for your answer and for the great job you do.
    m

    Reply
  11. Martin's avatarMartin

    I just installed CrashPlan on my DS1812+, and now I have 62 java processes running. Is this normal or what’s going on?

    Reply
    1. Martin's avatarMartin

      Okay, so I found a similar question in a previous comment above, and your answer to it. However, the java processes do not have the same process ID.

      Reply
      1. patters's avatarpatters Post author

        Does the same thing happen if you uninstall my Java package and use the one Synology provides for Intel systems?

  12. Leon's avatarLeon

    After i upgraded yor package for java i get: CrashPlan has been disconnected from the backup engine, and it seems it dosent upload any files eighter anymore, what do i do? (DS2413)

    Reply
    1. Leon's avatarLeon

      Ok, i installed Java from “Java Manager” instead with “jdk-6u45-linux-i586.bin”. But with the same results, it won’t upload anymore. =/

      Reply
    2. Leon's avatarLeon

      I uninstalled “java manager” and installed your java again.
      One thing i noticed is that crachplan package restarts itself also over and over.
      I wondering, can this be a ram/memory issue? (I just bought 2GB more ram that i wil get in a week or so, hope it helps)

      Reply
  13. Chad McDonald's avatarChad McDonald

    Hello Patters. CrashPlan has now released CrashPlan PROe 3.5.4. Do we need to wait for you to release a Synology package that corresponds with that version to update a Synology NAS running CrashPlan PROe server or can we just use the latest syno package you have available and install the CrashPlan upgrade file via the Web Interface of the CrashPlan PROe server like I’m used to doing on the other CrashPlan PROe servers I managed (not running on Synology NAS hardware)?

    Reply
    1. patters's avatarpatters Post author

      I have updated CrashPlan 3.5.3 packages for CP+, CPPRO, and CPPROe. They’re all ready (including for Armada 370) but I’m waiting for feedback about whether the realtime filesystem watching for Armada 370 is working before I release (I had to compile a lot with no testing possible).

      I will take a look at the CrashPlan PROe Server package after that, but it hasn’t been updated in a long while, plus I shall need to merge all the separate installer scripts like I did for all my other packages.

      Reply
  14. patters's avatarpatters Post author

    Good news for DS213j owners – I have been able to cross compile the binary dependencies necessary to support the Armada 370 CPU, complete with working real time backup! Thanks to iamroddo for testing.

    Reply
  15. nick's avatarnick

    hello, i updated to the new 3.5.3 crashplan package today and now I can no longer connect to the service on the synology from either my windows or mac computers. I’ve checked the ui.properties files, the service host IP address is correct an un-commented, and the port is set to 4243 and uncommented as well. I’ve manually stopped and restarted the service on the NAS, but still no joy.
    Also tried removing and re installing crashplan completely.
    I’m using the synology-provided java package.
    Any suggestions?

    Reply
    1. nick's avatarnick

      ok, did a little more troubleshooting on this.
      I can connect to the service successfully until I pause a running backup- once I’ve done that, I can’t connect again until the crashplan service has been stopped and restarted on the synology

      Reply
      1. nick's avatarnick

        anything? I had no problems for over a year with the older package, problems started immediately with 3.5.3 . . . .

  16. Jim's avatarJim

    Patters i know this is probably not the right section for this request, however I think others would find an interest in this as well. do you think you could get the FOG server install to work on the synology NAS? http://www.fogproject.org/ i’ve been reading up on it and it would be an awesome addition to these awesome boxes.

    Reply
  17. bram's avatarbram

    I am also having issues with the crashplan package. Port 4242 is open (tested with telnet), but port 4243 not, not even on localhost. The backups are not working as crashplan client show an outdated ip …

    Is it just me having these issues ?
    Glad to provide extra info, running on DS713+

    Reply
  18. Luiz's avatarLuiz

    Hi there! No problems here, I just wanted to say a big “thank you” for creating and maintaining this package. I have been using it for years on my ds 411+ now. Since data keeps getting more and more, I even outgrew the 1GB RAM, but with an upgraded 4GB bar, it runs perfectly. Thanks again!

    If you have a bitcoin address, I’d love to drop a small donation. If you don’t know what it is,check http://reddit.com/r/bitcoin

    Regards,
    Luiz

    Reply
  19. Kevin's avatarKevin

    Set this up on a DS412+ about two months ago and everything was working wonderfully until last week. We had to physically move the unit, and since we got it back up and running in the other room, the CrashPlan Pro package will silently shut off after 10 to 30 minutes of inactivity and the desktop client will disconnect. If I go back into the control panel and turn the package back on, it behaves normally again until it suddenly stops.

    I checked the error log (the system one, accessed via SSH) and it was completely empty. Nothing interesting in the system activity log or the standard activity log, either.

    Any ideas on how I could troubleshoot the issue? Running the 3.5.3 desktop client, with the 3.5.3-0022 package on the DiskStation. I tried uninstalling and reinstalling the package but no change.

    Reply
  20. Graham Wheeler's avatarGraham Wheeler

    For about the past two months now this has no longer worked for me. CrashPlan starts, and runs for somewhere between 2 and 5 minutes, and then restarts. It is making no progress with my backups and just chewing up resources. I have a DS-1512+ with 3GB RAM, and 1GB allocated to Java.

    The logs are just a continuous loop like this:

    Crashplan started
    Starting backup to Crashplan Central: NN files and (NN GB) to back up
    Scanning for files to back up
    Backup scheduled to always run
    Crashplan started

    Does anyone have any idea how to diagnose this?

    Reply
    1. Richard's avatarRichard

      How much data is there in your backup set (total amount)
      I made more backup sets with chunks of the complete backup, running smoothly after doing that.

      Reply
      1. nick's avatarnick

        i’ve got lots of backups sets- I’ve had those set up since I first installed crashplan– they worked fine until 3.5.3 was installed.
        3.5.3 package appears to be flat out broken in some instances at least.

  21. nick's avatarnick

    is there any way to revert to the old package? the old version worked perfectly for me for over a year, haven’t been able to upload a single bit of data to crashplan with 3.5.3.

    Reply
  22. bramvandeputte's avatarbramvandeputte

    Ive decided to just install crashplan manually by following this guide step by step :
    http://forum.synology.com/wiki/index.php/CrashPlan_Headless_Client#Making_CrashPlan_work_with_non_US-ASCII_characters

    worked like a charm !

    I hope in the near future patters will get support from Crashplan, or Crashplan will add their own package.
    Both Synology and Crashplan seem to have it on their agenda :

    Reply
  23. nick's avatarnick

    argh, may have found the problem- when I saw the repeated crashes and restarts in the log today, I decided to check my syno_package.vars file again- I had edited that file before since I do have lots of data being backed up. the file had been reset to the default with the heap size line commented out. i could have sworn that i’d uninstalled/reisntalled crashplan on the nas before without that file resetting to defaults- is that something you need to re-do after reinstalling, patters?
    anyway, hopefully that’s all the problem was . . . is there any way to delete posts on here? lol

    Reply
  24. Ametz's avatarAmetz

    Ok, i upgraded my ram (2 gig more, so now i have 4gig total) DS2413+
    But its restarting itself over and over now and then, and it still won’t upload files.
    Also the UI i have on my computer shuts down saying it loses contact with crashplan at random times (i suppose thats when it restarts) What can i do?

    Reply
    1. Dinges's avatarDinges

      How much heap size did you address to the java process? And how much data do you try to backup??
      did you try to resize the heap size??

      Reply
  25. Graham Wheeler's avatarGraham Wheeler

    I think I have found why the latest version keeps crashing. It seems like the heap is 512M even though I set it higher in the syno_package.vars file. I see this in app.log:

    JavaOptions = [-Dfile.encoding=UTF-8, -Dapp=CrashPlanService, -DappBaseName=CrashPlan, -Xms20m, -Xmx512m, …

    while my syno_package.vars says:

    USR_MAX_HEAP=2048M

    Anyone know how to fix this? Thanks.

    Reply
  26. Martinos's avatarMartinos

    Hi Patters, this solutions works very wel on my new Synology DS213+ (with the Freescale QorIQ P1022 PPC CPU)
    Many thanks for your easy implementation and useable installation description!

    Reply
  27. Ametz's avatarAmetz

    I have not changed anything in any file (don’t know how to change the heap size), only thing i tried to do is to uninstall Java, then install it again. I have lots of backup sets for different things, some are small around 1-500 hundred gig and some are big, the biggest is 2.4TB and most are 1.5TB (14 sets) DS2413+

    Reply
    1. Ametz's avatarAmetz

      Ops, this should have been a reply to “Dinges” last post, seems i cant remove and post it where it should myself.

      Reply
    2. Dinges's avatarDinges

      Ametz,
      Change the heap size (discribed in the “notes” from the opening post) and the backup will start to run.. btw, a backup of 2,4T will use a very large amount of memory to backup. But it will do with 4 Gb of physical memory..

      Reply
      1. Ametz's avatarAmetz

        I don’t know how to do that SSH thing, is there a program somewhere like an explorer that can open it instead, just like a normal folder? So i can edit that way?

      2. Dinges's avatarDinges

        There is a package called 3th party init. I think with that one you can do it.
        But SSH cannot be more simple! Download “putty” (freeware), connect to the NAS, and change the settings file! Nothing more to do..

      3. Dinges's avatarDinges

        Almost right… its linux.. but the principle is the same..
        editing of the file is done by the command “vi”.
        Google for the key-strokes to change the text in “vi”

      4. Ametz's avatarAmetz

        I can’t even find the file (dont know hot to “browse”), and i can’t find a youtube vids of the procedure eighter. =/

      5. Kevin's avatarKevin

        Get “WinSCP” and use SSH mode… it’s a pretty steep learning curve using PuTTY and having to command-line everything. WinSCP is a familiar FTP-type interface and would let you download the files, edit them locally and send them back (although be very careful with this – use Notepad++ or TED Notepad to edit, not the default Windows notepad, as it will very likely mess up the files).

      6. Ametz's avatarAmetz

        Kevin with that program i get:
        connection has been unexpectedly closed. server sent command exit status 255
        Cannot initialize SFTP protocol. Is the host running a SFTP server?

    1. Ametz's avatarAmetz

      Thats better, it was 512, i changed to 1024, should that be ok or do i need to add more? 1536 perhaps?

      Reply
    2. Ametz's avatarAmetz

      Ok that did not seem to work, even if i’m changing to 1536 and restart the ds2413 crashplan still shuts down, startup and shuts down again after 2-3 min over and over.

      Reply
  28. Graham Wheeler's avatarGraham Wheeler

    Ametz, that’s what I was seeing. In my case the setting in syno_package.vars was having no effect. Instead, I edited /volume1/@appstore/CrashPlan/bin/run.conf, and changed the -Xmx512m setting in the SRV_JAVA_OPTS line. That has worked for me; running 24 hours now without a restart, for the first time in weeks.

    Reply
    1. Ametz's avatarAmetz

      I changed that now to 2048 and that dosen’t seem to help me. Also, my ram never seems to go beyond 20% (Resource monitor). But i have ALOT of Java processes 4 Running and 85 sleeping Java processes. I also noticed that when crashplan die(restarts) so do ALL Java processes, not a single Java process is being showed in resource monitor for a few seeconds while it restarts.

      Reply
      1. Ametz's avatarAmetz

        I even tested to change it (in both files) to 3072 but its still starting over and over.
        See this image: http://s20.postimg.org/vghjjiihp/Capture1.png you can see when its starting over. But it seems that a few files have been uploaded tho, start to thinking “does it perhaps restart after each files(part of files) been uploaded?”

      2. Graham Wheeler's avatarGraham Wheeler

        Do you see anything in the logs? Look at the real logs, not the ones you will see in Package Manager. You want to look at the files here:

        /volume1/@appstore/CrashPlan/logs

        app.log should show you the Java flags so you can confirm they are correct. service.log.0 is probably the most interesting place to look for errors.

      3. Ametz's avatarAmetz

        That file is big and contains alot of shit, how i’m suposed to find the things i need to find when there is so much info in that file? “service.log.0 12236KB” “app.log is small 16KB” I can’t find any kind of timestamp in those files so i know when it happend.

        Also in app.log on line 431 i see this: memory = maxMemory=494.90MB, totalMemory=87.20MB, freeMemory=24MB, usedMemory=63.30MB

      4. Ametz's avatarAmetz

        This is too much for me, i think i gonna give up. But since more ppl have the same problem it must be something wrong with the code, and the best i can do is to shut it down and wait for a new release/update.

      5. Dinges's avatarDinges

        Did you try to backup just a few files… like 500 Mb or something.. Does it work than??
        It still looks like you have the default heap size (512Mb memory).

        Most of the people I see complaining about these problems start with a backup of 1/2/3Tb…

        I tried to make it work with a small backup and added more and more data… now running with over 3Tb of data backed up on a 1512+ with a heap size of 768Mb. Backup, splitted into several backup sets, working flawlessly.

        It is not rocket science, but it takes some patience and effort to get it working smoothly.

      6. Ametz's avatarAmetz

        I need to backup 9249GB. Yes i have alot of backup sets, i have now made alot more, i trying to make every backup set less then 700Gig (most around 600) Can you have too many backup sets btw? I have 26 sets atm.

      7. Dinges's avatarDinges

        I don’t know any limitations on the backup sets. But did it work with a backup of 500Mb?
        Like in my previous comment … Start small, than make it more complex..

  29. Graham Wheeler's avatarGraham Wheeler

    Ametz, you really care about errors. You can see the last 5 errors with:

    grep ERROR service.log.0 |tail -5 | more

    Also try:

    grep JavaOptions app.log

    and see what the -Xmx value is.

    Reply
    1. Ametz's avatarAmetz

      In app.log: JavaOptions = [-Dfile.encoding=UTF-8, -Dapp=CrashPlanService, -DappBaseName=CrashPlan, -Xms20m, -Xmx512m,

      Strange since i have changed in both files:
      syno_package.vars – #USR_MAX_HEAP=3072M

      run.conf – SRV_JAVA_OPTS=”-Dfile.encoding=UTF-8 -Dapp=CrashPlanService -DappBaseName=CrashPlan -Xms20m -Xmx3072m

      Reply
      1. Ametz's avatarAmetz

        I can find alot of this ones to in service.log.0: com.code42.exception.DebugException: OutOfMemoryError occurred…RESTARTING! message=OutOfMemoryError in BackupQueue!

      2. Dinges's avatarDinges

        Mystery probably solved…
        You still have the heap size “commented out”. The “#” in front of the command makes it a comment instead of a change in settings.

        Remove the “#” in the vars.

      3. Ametz's avatarAmetz

        How can i be that blind to miss something like that? I should have known that. Well i changed back both files to 1536 (strange tho run.conf file had reset’et itself to 512 by itself somehow)
        Anyway i removed the # added 1536 in both files and uploaded them and started the package again. lets see whats happening

      4. patters's avatarpatters Post author

        My startup script will set the heap size in run.conf every time the package is started, based on your physical RAM size, but will obey the override you can set in syno_package.vars.

        It will also put this value in the variable javaMemoryHeapMax in conf/my.service.xml which seems to have been needed since v3.5.3.

      5. Ametz's avatarAmetz

        Im not 100% sure yet. but it haven’t restarted itself yet. But so far i can say it looks good. it analyzing and sending a file for the first time in weeks now. I be back in some hours to tell more.

      6. Ametz's avatarAmetz

        Not one single restart since i removed the “#” and files have been uploaded one after another, it seems it does work as it should now, thanks Dinges.

  30. Sven C. Merckens's avatarSven C. Merckens

    Hi Patters,
    I face one problem with the current 3.5.3 CPPROe-package.

    I am using a DS1813+ (4GB RAM) as a backup applicance.
    It connects via CIFS to another NAS (which does not support CrashPlan) and creates two backups.
    One backup internally on the harddrives (in /volume1/crashplan/backupArchives) and one backup online to a CrashPlanPROe-Server.
    There seems to be a problem with the privileges of the local destination, because after a “restart”-command in the CPPROe-client or a restart via the package manager the client shows: “Connecting to backup destination”.. just for the local destination.
    I changed the privileges for /volume1/crashplan via chmod -R 0777 /volume1/crashplan but this doesn’t work. If I uninstall the package and reinstall it, everything is working again, but only until the client is restarted.
    I can’t find any error in the log-files….

    Reply
  31. Frederik's avatarFrederik

    I have been a happy user of crashplan the past 2 years and a happy user of this script. Since version 3.5.2 (0022) I havent been able to use crashplan.

    I have a synology diskstation running on IP: 192.168.0.100
    I have installed crashplan on the Diskstation using: https://pcloadletter.co.uk/2012/01/30/crashplan-syno-package/
    Its is running version: 3.5.3
    Is use MacOS version 10.7.5 and did install crashplan on my desktop. The latest version.
    I did edit: /Applications/CrashPlan.app/Contents/Resources/Java/conf/ui.properties
    and changed serviceHost to: serviceHost=192.168.0.100

    And I have a consol open where I did run:
    ssh -L 4200:localhost:4243 admin@192.168.0.100

    When I start crashplan it crash with text like this (pastebin below):
    What to do…. – please help…
    http://pastebin.com/Xy5Fvzuy

    Reply
    1. patters's avatarpatters Post author

      You don’t need to do that SSH port tunnelling if both the client and your NAS are on the same LAN. It’s only intended when you’re connecting to your NAS when you’re away from home. I’m not sure what your issue is though. Do you have a PC you could test with, in case your Mac is the problem? I upgraded my MacBook to Mac OS 10.8 and had a lot of hassle trying to get Java 7 on there – which I would recommend using. By default Mac OS tries to put Java 6 on. Also 10.8 introduced code signing requirements, so something like that could be to blame (you could try disabling that in the Security pane in your Mac’s Settings.

      Reply
      1. Daniel Smith's avatarDaniel Smith

        You can easily install Java 7 — just download it from http://www.java.com . But Google Chrome only supports Java 6, so if you are using Chrome it wont download 7 or run java apps if you have already installed 7. Use Safari to upgrade to Java 7.

        Java has its own control panel in Mtn Lion so you can use that to adjust permissions and security levels in addition to adjusting in your browser’s security settings.

      2. patters's avatarpatters Post author

        Downloading and installing it wasn’t the tricky part, but I seem to remember that the making Java 7 the default for running standalone apps (like Serviio) – not web content – was the issue. IIRC there was also some 32 Vs 64bit fun and games too.

        The other thing was that Apple didn’t publicize the fact that the Java control panel gets replaced and you can’t go back to the old one – so I first thought that my OS had become messed up. The way it opens up in a separate window is so clunky and out of step with Mac OS as to look fundamentally broken.

        As a rule, Java is so insecure for web content that it should be disabled in the browser by default.

      3. Frederik's avatarFrederik

        Thanks for the reply.

        I run JAVA 7 on my DiskStation and

        You have the recommended Java installed (Version 7 Update 25).

        On my mac 10.7.5

        Hmmm…..

  32. Andrew Ng's avatarAndrew Ng

    This was the easiest install on my DiskStation yet, took 5 minutes and everything is working, it’s backing itself up to Crashplan, and I have 2 other Macs on the network backing up to it. Really amazing. Thank you for all your work!

    Reply
  33. John's avatarJohn

    We moved our DS to a new subnet and now Crashplan always shows the DS as disconnected from all the PCs.
    Tried restarting, re-installing, etc. nothing works.
    Also, I can’t seem to connect to the DS’s Crashplan service. When I try to change ui.properties (on PC) to the IP of the DS, it still connects to the local PC (even after restart of PC’s CrashPlan service).
    Any suggestions?
    Version 3.5.3-002

    Reply
    1. John's avatarJohn

      Never mind. Sorted. It worked ok if I stopped the service on the client I was connecting *from*

      Reply
  34. threeonesix's avatarthreeonesix

    I have recently taken over management of a RS2212+ that previously employed your CrashPlan package. I say previously because the previous person who managed this NAS removed the CrashPlan package prior to being fired. Now when I try to re-add the package it does not show up in Package Center. I am guessing it does not show up because it was previously installed by removed. Is there a way I can get the package to re-appear so that it can be re-installed and configured?

    Reply
  35. threeonesix's avatarthreeonesix

    Nevermind, got it reinstalled. Can’t get the client to login to our account, which is a CrashPlan Pro account. That shouldn’t matter, right?

    Reply
    1. patters's avatarpatters Post author

      The ex-staff member may have changed the account credentials. You can check by attempting to log into the CrashPlan website, then hopefully do a password reset if the email address wasn’t changed. If it was, I’m sure you can re-establish ownership by dealing with CrashPlan support and sending them proof of payment for instance.

      Reply
  36. Eric Goldstein's avatarEric Goldstein

    Hi –

    I”ve got a 413J and I’ve got the CrashPlan software & Java software running on it.

    I modified the ui.properties file (adding serviceHost=192.168.1.9) on the mac that is currently already set up with Crashplan. (not a “new machine”) When I re-ran CrashPlan, it basically assumed that I was setting up a “new CrashPlan” and I assume I was losing the back-up I had set up. So, I quickly modified it back (commented out that line).

    Questions:

    – Can I include that “servicerHost” line, set up the Crashplan on the Synology, and then take that line out and have everything work ok? Or do I really need to install CrashPlan on some other random PC that is not currently included.

    – Once I do this, I’m assuming I’ll be able to set up a backup of my mac TO my synology. Basically setting it up as a destination.

    – I’m also assuming this will allow me to directly backup from the Synology to another location / online.

    Thanks for your help. I”m a little new to the inner works of this monster.

    Eric

    Reply
    1. Eric Goldstein's avatarEric Goldstein

      I’m really wondering if I can set this up on the same mac that is already set up with CrashPlan. Not clear why I’d need to install it on a “new” machine.

      Reply
      1. patters's avatarpatters Post author

        You don’t need to use a new machine. Even on a client computer there’s an engine service, and the management GUI app that are quite separate. So you can use the GUI to manage both your Mac and the NAS simply by changing that line in conf/ui.properties.

      2. Eric Goldstein's avatarEric Goldstein

        Patters,

        So, just to confirm what I should do.

        If I modify the ui.properties line and re-run CrashPlan, it will ask me to set up a new machine. Once I do that, I’ll be able to access both the existing Mac and the Synology drive. And I won’t have to / shouldn’t go back and “remodify” the ui.properties file to comment it out. Just leave it alone.

        Thanks,

        Eric

      3. Eric Goldstein's avatarEric Goldstein

        Patters,

        I got it working.

        However, it seems that if I wanted to change the backup from the Synology to CrashPlan, I’d need to go back in and modify that ui.properties file again (un-commented out the link).

        But it seems like I’m able to back-up to the synology and synology to CrashPlan which is the idea.

        Thanks,.

        Eric

      4. Joerg W.'s avatarJoerg W.

        I made a duplicate of the CrashPlan programm itself on the mac and modified those settings within the duplicate named “CrashPlanSyno” – that way I can keep controll of both – even running both at the same time.

  37. Glenn's avatarGlenn

    Hi,

    I think I installed the packages successfully on a DiskStation 213. Interestingly it couldn’t download the CrashPlan package directly in the Package center (DSM 4.2), so I had to download manually and put in the public share.

    When I run the client on my Windows PC (after adjusting config file) it asks me to login to CrashPlan service or create new account (thus it seems to connect to DiskStation ok). Choosing either option results in it saying “Please Wait” for agents and then presents in an error “Unable to connect, check your network”.

    I set the config file back to local settings and restarted the service and was able to register a new account successfully and login.

    Put the config back to the DiskStation IP and again the same problem… was thinking perhaps an internet access issue with the NAS (remembering I had to download Crashplan for Linux manually), but it downloads other packages ok and uses Download Station ok.

    Any thoughts anyone on what I can test/check?

    Reply
  38. Jack's avatarJack

    Would someone mind pointing me in the right direction on how to change the heap size? I know I have to edit file…but need exact steps to accomplish this. I can not find the right file to edit not do I know what program to use to edit the file. Thank you.

    Reply
    1. Jack's avatarJack

      Ok, I have edited /volume1/@appstore/CrashPlan/syno_package.vars file and changed heap size to 1024m. Where do I check to see if that heap change has taken effect? Is there another file I need to change. I read earlier where Mike talked about also changing my.service.xml file. Thanks.

      Reply
      1. patters's avatarpatters Post author

        Don’t change my.service.xml. Since that info was posted, the package pushes the value from syno_package.vars to that file also.

    2. Dinges's avatarDinges

      change the file /volume1/@appstore/CrashPlan/syno_package.vars
      Program to edit the file: vi
      Do not forget to remove the # in front of the command: #USR_MAX_HEAP=XXXX

      after editing, stop and start the package.
      checking the heap size, vi engine_output.log

      (How to use vi, do the google trick)

      Reply
      1. Jack's avatarJack

        Thank you both for the help.

        I am still having difficulty viewing the engine_output.log file.

        I’ve tried using vi as suggested but do not see reference to heap size. That file is located in /volume1/@appstore/CrashPlan/log/engine_output.log

        Correct?

  39. nvt1's avatarnvt1

    Great tool – requires a bit of set up and configuration but well worth while for the triple back up available for your NAS on Synology..thanks. Sent a donation. Wish I had seen the link for crashplan sign up as I would have used that if I had seen it first. My suggestion – put the link for that and the paypal donation as big buttons at the top so easy to find

    Reply
  40. Sean's avatarSean

    I had everything working for nearly long enough to backup the 2+TB on my synology, but it seems this latest update has dashed my hopes of finally feeling secure.

    I’m running a 1512+ with the latest 3.5.3-0022

    I updated using the package center and tried starting up within package center afterwards, only to wait a bit and see the ‘run’ button again. I then went into the command line and tried starting, restarting, forced reloading, etc…but nothing seems to work. I’ve even tried restarting the synology.

    Hoping I havent lost the nearly complete progess I’ve made transferring to crashplan. Why cant they natively support us!!!

    Reply
  41. Jason's avatarJason

    Hello patters. Long time user here and I appreciate the fine work you have put into this. I have a ds212j and updated the package recently and it stopped working. I uninstalled the package and went to reinstall and found that none of the Crashplan packages appear in the list anymore. I’m guessing that when you updated the package for the new armada 370, something you did made the package incompatible with the armada 300 used in the ds212j. Is this change intentional? Is it possible to get the 300 added back to the compatibility list?

    Reply
  42. Frank's avatarFrank

    Hallo patters. Thanks for the great work!
    With version 0022 I also have the problem that backup is not working anymore (see previous posts). I have a DS211+.

    Reply
  43. Mark's avatarMark

    Thanks Patters! I have version 0022 running successfully on a new DS213j currently backing up 750GB to Crashplan Central. I have had no problems with the limited (512MB) memory of the DS213j whatsoever. The 750GB backup was previously on a Windows 7 computer but I was able to successfully allow the DS213j to adopt the backup. One note: in order to complete the adoption without re-uploading all of the files from scratch I did need to clear the CrashPlan cache (“backup.replace 42”) .

    Reply
  44. Michal Holm's avatarMichal Holm

    Hi

    I’m having problems aswell, my backup is not running, it is stuck on analyzing. I have tried uninstalling both CP and java 6, but that didn’t work. I have a DS212j.

    Is it possible to downgrade to the earlier version, if so, how do I get the files ?

    regards Michal

    Reply
  45. Lawrence's avatarLawrence

    I’ve tried installing this package several times on my 1511+ but I can’t get it to start. The dialog comes up saying it started correctly, but the GUI still always says “stopped”. I am running an older DSM (3.2) I don’t know if that could be the reason. JRE 6 is already installed. Any ideas?

    Reply
  46. Pingback: My Home File Server Solution: Synology and CrashPlan | Scott Koland's blog

Leave a comment