linux_wiki:crashplan_ui_config

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux_wiki:crashplan_ui_config [2014/11/17 21:56]
billdozor created
linux_wiki:crashplan_ui_config [2019/05/25 23:50] (current)
Line 1: Line 1:
 ====== CrashPlan UI Config ====== ====== CrashPlan UI Config ======
  
-**Distro(s):** All+**General Information**
  
-**Description:** Script to configure the CrashPlan UI to connect to your local system or a remote headless server running the CrashPlan service. Also fixes the GUI crash bug reported here: [[ https://support.code42.com/CrashPlan/Latest/Troubleshooting/CrashPlan_Client_Closes_In_Some_Linux_Installations ]]+Script to configure the CrashPlan UI to connect to your local system or a remote headless server running the CrashPlan service.
  
-<code>+Also fixes the GUI crash bug reported here(Crashplan Versions 3.5.3 to 3.6.4): [[ https://support.code42.com/CrashPlan/Latest/Troubleshooting/CrashPlan_Client_Closes_In_Some_Linux_Installations ]] 
 + 
 +**Checklist** 
 +  * Distro(s): Any 
 +  * Other: Crashplan installed [[https://www.code42.com/crashplan/download/]] 
 + 
 +---- 
 + 
 +===== Sources ===== 
 + 
 +Used the following official documentation source to write this script: 
 +  * http://support.code42.com/CrashPlan/4/Configuring/Using_CrashPlan_On_A_Headless_Computer 
 + 
 +---- 
 + 
 +===== The Script =====  
 + 
 +<code bash crashplan_ui_config.sh>
 #!/bin/bash  #!/bin/bash 
  
-echo -e "====== CrashPlan UI Configuration =====\n"+## Title: CrashPlan UI Config 
 +## Description: Configure the CrashPlan UI to connect to a remote server or revert back to local host. 
 +##              Also fixes a UI crash bug in certain versions.  
 +## Author: Bill Howe 
 +## Date: 08/09/2015  
 +## Recent Changes: Re-designed into functions, added root and version checking.
  
-echo -e "Use CrashPlan UI to connect to:" +## Required, check for root permissions ## 
-echo -e "1) Local system" +check_root=$(id -u) 
-echo -e "2) Remote headless system" +if [ $check_root != 0 ];then 
-echo -e "3) Fix UI Crash Bug"+  echo ">>ERROR: Must have root permissions to execute this script. (either as root user or sudo)" 
 +  exit 1 
 +fi 
 + 
 +## Setting up variables - Configure to Crashplan's root ## 
 +CPROOT="/opt/crashplan" 
 + 
 +## Store Crashplan version ## 
 +CPVERSION="$(awk '/CPVERSION/ {print $3}' ${CPROOT}/log/app.log)" 
 + 
 +## Functions ## 
 +function initial_symlink_setup { 
 +  # check to see if either ui file does not exist 
 +  if [[ ! -f /var/lib/crashplan/.ui_info.local ]]; then 
 +    # local file does not exist, create it 
 +    echo ">>Inital Setup: Creating local ui_info version..."  
 +    sudo cp -v /var/lib/crashplan/.ui_info /var/lib/crashplan/.ui_info.local 
 +  fi 
 + 
 +  if [[ ! -f /var/lib/crashplan/.ui_info.remote ]]; then 
 +    echo ">>Initial Setup: Copying remote UI file to local system..." 
 +    echo -e "=>IP or Hostname of remote system: \c" 
 +    read INITIALSYSTEM 
 +    echo -e "=>Username on remote system: \c" 
 +    read INITIALUSER 
 + 
 +    echo -e ">> Enter login password next to copy remote UI id file to local system." 
 +    sudo scp ${INITIALUSER}@${INITIALSYSTEM}:/var/lib/crashplan/.ui_info /var/lib/crashplan/.ui_info.remote 
 +    sudo sed -i 's/^4243/4200/' /var/lib/crashplan/.ui_info.remote 
 + 
 +    # set to local initially 
 +    sudo ln -fs /var/lib/crashplan/.ui_info.local /var/lib/crashplan/.ui_info 
 +  fi 
 +
 + 
 +function configure_local { 
 +  echo -e "\n>>Configuring for Local system" 
 + 
 +  if [[ ${CPNEW} == "true" ]];then 
 +    # Version >= 4.3.0, change symlink 
 +    sudo ln -sf /var/lib/crashplan/.ui_info.local /var/lib/crashplan/.ui_info 
 +  else 
 +    # Version < 4.3.0, edit ui.properties 
 +    sed -i "s/servicePort=4200/#servicePort=4243/" ${CPROOT}/conf/ui.properties 
 +  fi 
 + 
 +  echo -e ">>...Complete. CrashPlan UI ready for local system.\n" 
 +
 + 
 +function configure_remote { 
 +  echo -e "\n>>Configuring for Remote System" 
 + 
 +  echo -e "=>IP/Hostname of Remote system to connect to: \c" 
 +  read REMOTESYSTEM 
 +  echo -e "=>Username on Remote System: \c" 
 +  read REMOTEUSER 
 + 
 +  if [[ ${CPNEW} == "true" ]];then 
 +    # Version >= 4.3.0, change symlink 
 +    sudo ln -sf /var/lib/crashplan/.ui_info.remote /var/lib/crashplan/.ui_info 
 +  else 
 +    # Version < 4.3.0, edit ui.properties 
 +    sed -i "s/#servicePort=4243/servicePort=4200/" ${CPROOT}/conf/ui.properties 
 +  fi 
 +   
 +  echo -e ">>Login to remote system via ssh below, then launch CrashPlanDesktop locally from non-ssh terminal or desktop.\n" 
 +  echo -e ">>Opening SSH connection to remote system..." 
 +  ssh -L 4200:localhost:4243 ${REMOTEUSER}@${REMOTESYSTEM} 
 +
 + 
 +function fix_ui_bug { 
 +  # Check if CP Version is >= 3.5.3 
 +  if [[ $(echo | awk -v n1=${CPVERSION} -v n2=3.5.3  '{if (n1>=n2) print ("true"); else print ("false");}') == "true" ]]; then  
 +    UITEST1="true" 
 +  else  
 +    UITEST1="false" 
 +  fi 
 +  # Check if CP Version is <= 3.6.4 
 +  if [[ $(echo | awk -v n1=${CPVERSION} -v n2=3.6.4  '{if (n1<=n2) print ("true"); else print ("false");}') == "true" ]]; then  
 +    UITEST2="true" 
 +  else  
 +    UITEST2="false" 
 +  fi 
 + 
 +  # If both true, fix the bug 
 +  if [[ ${UITEST1} == "true" && ${UITEST2} == "true" ]];then 
 +    echo ">>Your Crashplan version, ${CPVERSION}, is affected by the UI Crash Bug, attempting to fix..." 
 +    echo -e "\n>>Adding '-Dorg.eclipse.swt.browser.DefaultType=mozilla' to ${CPROOT}/bin/run.conf..." 
 +    sed -i "/GUI_JAVA_OPTS/D" ${CPROOT}/bin/run.conf 
 +    echo 'GUI_JAVA_OPTS="-Dfile.encoding=UTF-8 -Dapp=CrashPlanDesktop -DappBaseName=CrashPlan -Xms20m -Xmx512m -Djava.net.preferIPv4Stack=true -Dsun.net.inetaddr.ttl=300 -Dnetworkaddress.cache.ttl=300 -Dsun.net.inetaddr.negative.ttl=0 -Dnetworkaddress.cache.negative.ttl=0 -Dc42.native.md5.enabled=false -Dorg.eclipse.swt.browser.DefaultType=mozilla"' >> ${CPROOT}/bin/run.conf 
 +    echo -e ">>...Done." 
 +  else 
 +    echo ">>Your Crashplan version, ${CPVERSION}, is NOT affected by the UI Crash Bug." 
 +  fi 
 +
 + 
 +### Main Program ### 
 + 
 +# Check to see if Crashplan version is 4.3.0 or greater, if so, initalize symlinks setup 
 +if [[ $(echo | awk -v n1=${CPVERSION} -v n2=4.3.0  '{if (n1>=n2) print ("true"); else print ("false");}') == "true" ]]; then  
 +  CPNEW="true" 
 +  initial_symlink_setup 
 +else  
 +  CPNEW="false" 
 +fi 
 + 
 +## Main Menu ## 
 +echo -e "===== CrashPlan UI Configuration =====" 
 +echo -e "----- Your Version: ${CPVERSION} -----\n" 
 + 
 +echo -e "Configure CrashPlan to:" 
 +echo -e "1) Connect to Local system" 
 +echo -e "2) Connect to Remote headless system" 
 +echo -e "3) Fix UI Crash Bug (CP vers 3.5.3 to 3.6.4)"
 echo -e "q) Quit" echo -e "q) Quit"
 echo -e "\nSelection:\c" echo -e "\nSelection:\c"
  
-read SYSTEM+read CHOICE
  
-case $SYSTEM in+case ${CHOICE} in
  
   1)   1)
   # Configure for local   # Configure for local
-  echo -e "\n>>Configuring for Local system" +  configure_local
-  sed -i "s|servicePort=4200|#servicePort=4243|" /usr/local/crashplan/conf/ui.properties +
-  echo -e "...Complete. CrashPlan UI ready for local system.\n"+
   exit 0   exit 0
   ;;   ;;
Line 31: Line 164:
   2)   2)
   #Configure for remote   #Configure for remote
-  echo -e "\n>>Configuring for Remote System" +  configure_remote
-  echo -e "IP/Hostname of Remote system to connect to: \c" +
-  read REMOTESYSTEM +
- +
-  echo -e "Username on Remote System: \c" +
-  read REMOTEUSER +
- +
-  echo -e "Login via ssh below, then launch CrashPlanDesktop from non-ssh session on local system.\n" +
-  echo -e "\nOpening SSH connection to remote system..." +
- +
-  sed -i "s|#servicePort=4243|servicePort=4200|" /usr/local/crashplan/conf/ui.properties +
-  ssh -L 4200:localhost:4243 $REMOTEUSER@$REMOTESYSTEM+
   ;;   ;;
  
   3)   3)
   #Fix UI Crashing   #Fix UI Crashing
-  echo -e "\n>>Adding '-Dorg.eclipse.swt.browser.DefaultType=mozilla' to /usr/local/crashplan/bin/run.conf..." +  fix_ui_bug
-  sed -i "/GUI_JAVA_OPTS/D" /usr/local/crashplan/bin/run.conf +
-  echo 'GUI_JAVA_OPTS="-Dfile.encoding=UTF-8 -Dapp=CrashPlanDesktop -DappBaseName=CrashPlan -Xms20m -Xmx512m -Djava.net.preferIPv4Stack=true -Dsun.net.inetaddr.ttl=300 -Dnetworkaddress.cache.ttl=300 -Dsun.net.inetaddr.negative.ttl=0 -Dnetworkaddress.cache.negative.ttl=0 -Dc42.native.md5.enabled=false -Dorg.eclipse.swt.browser.DefaultType=mozilla"' >> /usr/local/crashplan/bin/run.conf +
-  echo -e "...Done."+
   exit 0   exit 0
   ;;   ;;
  • linux_wiki/crashplan_ui_config.1416279380.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)