facelordgists
11/9/2015 - 12:41 AM

Setup Barracuda Copy Console on Ubuntu 14.04 & ServerPilot

Setup Barracuda Copy Console on Ubuntu 14.04 & ServerPilot

#!/bin/sh
# CopyConsole (Copy cloud storage by Barracuda) service

copyConsolePath="/srv/users/serverpilot/scripts/copy/CopyConsole"
copyUser="serverpilot"
userHomeDir="/srv/users/serverpilot"

start() {
   echo "Starting CopyConsole..."
       if [ -x $copyConsolePath ]; then
           HOME="$userHomeDir" start-stop-daemon -b -o -c $copyUser -S -u $copyUser -x $copyConsolePath -- -daemon
       fi
}
 
stop() {
   echo "Stopping CopyConsole..."
       if [ -x $copyConsolePath ]; then
           start-stop-daemon -o -c $copyUser -K -u $copyUser -x $copyConsolePath
       fi
}
 
status() {
       dbpid=`pgrep -u $copyUser CopyConsole`
       if [ -z $dbpid ] ; then
           echo "CopyConsole for USER $copyUser: not running."
       else
           echo "CopyConsole for USER $copyUser: running (pid $dbpid)"
       fi
}
 
case "$1" in
 
   start)
       start
       ;;
   stop)
       stop
       ;;
   restart|reload|force-reload)
       stop
       start
       ;;
   status)
       status
       ;;
   *)
       echo "Usage: /etc/init.d/copyconsole {start|stop|reload|force-reload|restart|status}"
       exit 1
 
esac
 
exit 0

Install Copy

This assumes you've already got a working copy of Ubuntu 14.04 and ServerPilot setup.

For my configuration, I'm putting the sync folder at /srv/users/serverpilot/copy and the scripts at /srv/users/serverpilot/scripts/copy. You can adjust as you see fit.

  1. SSH in as serverpilot user

  2. Create some directories

     mkdir -p /srv/users/serverpilot/scripts/copy_temp` #install folder
     mkdir /srv/users/serverpilot/scripts/copy` #app folder
     mkdir /srv/users/serverpilot/copy` #sync folder
    
  3. Download

     wget https://copy.com/install/linux/Copy.tgz -P /srv/users/serverpilot/scripts/copy_temp
    
  4. Extract to temp dir

     tar xvzf /srv/users/serverpilot/scripts/copy_temp/Copy.tgz -C /srv/users/serverpilot/scripts/copy_temp
    
  5. Move 64bit version to a permanent director

     mv /srv/users/serverpilot/scripts/copy_temp/copy/x86_64 /srv/users/serverpilot/scripts/copy
    
  6. Fire it up

    • Make sure and swap out the user and password. If you'd like, you can leave off the password and type it in after running the script to avoid logging it to the bash history

        /srv/users/serverpilot/scripts/copy/CopyConsole -r=/srv/users/serverpilot/copy -u=the_mail_you_signed_up_with -p=the_password_you_signed_up_with
      
  7. Press Control + C once you've got it setup and running.

Setup CopyConsole as a service so it runs on startup

  1. Log into server as root

  2. Create /etc/init.d/CopyConsole

     touch /etc/init.d/CopyConsole
     nano /etc/init.d/CopyConsole
    
  3. Paste the contents of CopyConsole into there, then press control + x to exit. Press enter to save it under the same name.

     chmod +x /etc/init.d/CopyConsole 
     update-rc.d CopyConsole defaults
    
  4. Symlink it

     ln -s /etc/init.d/CopyConsole /usr/bin/CopyConsole
    
  5. Fire it up

     CopyConsole start
    

Usage:

CopyConsole {start|stop|reload|force-reload|restart|status}

Start

CopyConsole start

Status

CopyConsole status

Stop

CopyConsole stop