Osiris

Members
  • Posts

    29
  • Joined

  • Last visited

Posts posted by Osiris

  1. I'm kinda having the same issue besides I'm not using wireless...

    I am syncing 2 Nas devices over wired LAN (freenas and qnap).

    I'm getting the double arrow icons.

    The transfer speed is a constant 3MB/s

    When copying a file directly from nasshare to nasshare, the speed is 70MB/s which is closer to my Gigabyte lan connection.

    This is when scp'ing one file to the other device using putty, so no intermediaries.

  2. Have been struggling a bit with FreeNas and btsync.

    Now that it all works without the need for a jail (I think), here are my findings.

    I assume a volume has been set up on the FreeNas.

    • create a user 'btsync' with a homedir accessible for writing after the reboot.
    • log on to FreeNas using ssh (putty or shell) with the root user.
    • enable write access on the OS.

      mount -uw /


    • based on http://forums.freena...-install.12722/ I adapted a btsync_install.sh script :
      #!/bin/sh
      # Installs Bittorrent Sync (btsync) under a FreeNAS jail
      # based on http://forums.freenas.org/threads/bittorrent-sync-install.12722/
      # 2013-08-20
      # edited a bit by tim@chaubet.be on 2013-09-05

      cd /tmp

      echo -n "Would you like to install Bittorrent Sync (y/n)? [n] : "
      read install_btsync

      if [ $install_btsync = "y" ]; then
      echo "Initialization of btsync user"
      if [ `more /etc/passwd | grep btsync | wc -l` -gt 0 ]; then
      echo "The btsync user exists. Make sure the home_dir has RW access after boot."
      user_exists=1
      else
      echo "Creation of btsync user should be done via the GUI."
      echo "Set a home_dir which will have write access after reboot, so outside the boot OS."
      #pw useradd btsync -m -c "User Bittorrent Sync" -s /bin/sh -w yes
      user_exists=0
      fi
      if [ user_exists==1 ]; then
      home_dir=`more /etc/passwd | grep btsync | awk -F':' '{ print $6 }'`
      echo "home dir : $home_dir"
      if [ ! -e $home_dir ]; then
      mkdir $home_dir
      echo "home dir did not exist ! -> created."
      fi
      ls -hltrd $home_dir
      config_dir="$home_dir/.conf"
      config_btsync_dir="$config_dir/btsync"

      if [ ! -e $config_dir ]; then
      mkdir $config_dir
      echo "$config_dir created."
      fi
      if [ ! -e $config_btsync_dir ]; then
      mkdir $config_btsync_dir
      echo "$config_btsync_dir created."
      fi
      chown -R btsync $home_dir
      echo "owner of $home_dir changed to btsync."
      chmod -R 744 $home_dir
      echo "permissions on $home_dir changed to rwxr--r--."

      if [ -e btsync_freebsd_x64.tar.gz ]; then
      rm btsync_freebsd_x64.tar.gz
      fi
      echo "Downloading Bittorrent Sync: btsync_freebsd_x64 from amazonaws."
      fetch "http://btsync.s3-website-us-east-1.amazonaws.com/btsync_freebsd_x64.tar.gz"

      if [ -e btsync ]; then
      rm btsync
      echo "existing btsync removed."
      fi
      echo "Extraction of Bittorrent Sync."
      tar xvfz btsync_freebsd_x64.tar.gz
      echo "Copying Bittorrent Sync."
      cp btsync $config_btsync_dir
      chmod -R 755 $config_btsync_dir

      echo "Initialization of the daemon...ROAR"
      cat > "/etc/rc.d/btsync" <<EOF
      #!/bin/sh

      # PROVIDE: btsync
      # REQUIRE: NETWORKING SERVERS DAEMON ldconfig resolv

      # btsync service
      # Take from <https://gist.github.com/MendelGusmao/5398362>

      home_dir=`more /etc/passwd | grep btsync | awk -F':' '{ print $6 }'`
      config_dir="$home_dir/.conf"
      config_btsync_dir="$config_dir/btsync"

      # Replace with linux users you want to run BTSync clients for
      BTSYNC_USERS="btsync"
      DAEMON=$config_btsync_dir/btsync

      name="btsync"
      rcvar="btsync_enable"
      #command="$config_btsync_dir/\${name}"

      start() {
      echo "Starting btsync..."
      for btsuser in \$BTSYNC_USERS; do
      HOMEDIR=\`more /etc/passwd | grep \$btsuser | awk -F':' '{ print \$6 }'\`
      #echo "launched from \$HOMEDIR "
      if [ -d \$HOMEDIR/.conf ]; then
      command="\$HOMEDIR/.conf/btsync/btsync"
      echo "btsuser : \$btsuser running command : \$command"
      su -l \$btsuser -c "\$command --config \$HOMEDIR/.conf/btsync/config.json"
      fi
      done
      }

      stop() {
      echo "Stopping btsync..."
      for btsuser in \$BTSYNC_USERS; do
      HOMEDIR=\`more /etc/passwd | grep \$btsuser | awk -F':' '{ print \$6 }'\`
      if [ -d \$HOMEDIR/.conf ]; then
      dbpid=\`pgrep -u \$btsuser btsync\`
      if [ -z "\$dbpid" ]; then
      echo "btsync for USER \$btsuser: not running."
      else
      echo "Stopping btsync for USER \$btsuser: running (pid \$dbpid)"
      kill \$dbpid
      until [ -z "\$dbpid" ]
      do
      dbpid=\`pgrep -u \$btsuser btsync\`
      echo -n "."
      sleep 1
      done
      echo ""
      fi
      fi
      done
      }

      status() {
      for btsuser in \$BTSYNC_USERS; do
      dbpid=\`pgrep -u $btsuser btsync\`
      if [ -z "\$dbpid" ]; then
      echo "btsync for USER \$btsuser: not running."
      else
      echo "btsync for USER \$btsuser: running (pid \$dbpid)"
      fi
      done
      }

      case "\$1" in
      start)
      start
      ;;
      stop)
      stop
      ;;
      restart|reload|force-reload)
      stop
      start
      ;;
      status)
      status
      ;;
      *)
      echo "Usage: $/etc/rc.d/btsync {start|stop|reload|force-reload|restart|status}"
      echo " service btsync {start|stop|reload|force-reload|restart|status}"
      exit 1
      esac
      exit 0

      EOF
      chmod 755 /etc/rc.d/btsync
      cp /etc/rc.d/btsync /conf/base/etc/rc.d/
      echo "created btsync startup process in /etc/rc.d/ and /conf/base/etc/rc.d/"

      if [ `more /etc/rc.conf | grep btsync | wc -l` -lt 1 ]; then
      echo "btsync_enable=\"YES\"" >> /etc/rc.conf
      fi

      echo "Web Interface configuration"
      echo -n "User login to the web interface : "
      read user
      echo -n "Password to connect to the web interface : "
      read pwd

      cat > "$config_btsync_dir/config.json" <<EOF
      {
      "device_name": "Freenas",
      "listening_port" : 0, // 0 - randomize port

      /* storage_path dir contains auxilliary app files
      if no storage_path field: .sync dir created in the directory
      where binary is located.
      otherwise user-defined directory will be used
      */
      "storage_path" : "$config_btsync_dir",

      // uncomment next line if you want to set location of pid file
      // "pid_file" : "/var/run/syncapp/syncapp.pid",
      "pid_file" : "$config_btsync_dir/syncapp.pid",

      "check_for_updates" : true,
      "use_upnp" : true, // use UPnP for port mapping

      /* limits in kB/s
      0 - no limit
      */
      "download_limit" : 0,
      "upload_limit" : 0,

      /* remove "listen" field to disable WebUI
      remove "login" and "password" fields to disable credentials check
      */
      "webui" :
      {
      "listen" : "0.0.0.0:8888",
      "login" : "$user",
      "password" : "$pwd"
      }

      }
      EOF
      chown btsync $config_btsync_dir/config.json
      chmod 744 $config_btsync_dir/config.json

      echo "Launching btsync :"
      /etc/rc.d/btsync start
      fi
      fi


      Create the file in the root homedir, give exe access and run it :


      cd /root
      vi installscript.sh


      [insert], paste the script and save (:wq)


      chmod +x installscript.sh
      sh installscript.sh


    • After that, add a post-init command via the freenas-gui that says

      service btsync start