NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
Squazz
May 22, 2013Aspirant
BitTorrent Sync - How To
This guide is outdated. I havn't got the time to make it up to par Following this guide with above disclaimer is your own responsibility If you havn't read about BT Sync already, do yourself a fav...
fastfwd
Sep 04, 2013Virtuoso
Squazz wrote: It seems that BT Sync dosn't automatically start up with your NAS. At the moment you will have to manually start the service every time you reboot you NAS by opening putty and SSH into your readynas, and then entering ./btsync in the console
To make BTSync start (and cleanly shut down) with your NAS, save the script below as /etc/init.d/btsync
If necessary, modify the "DAEMON=" line first, so it points to your btsync executable. If you followed Squazz's directions exactly -- that is, if you did not "cd" between logging in to your NAS and extracting btsync -- the executable will be in your home directory, so the line should say "DAEMON=~/btsync" (without the quotes).
#! /bin/sh -e
# Make sure that the "DAEMON=" line below points to your btsync executable
# (e.g., if you unpacked btsync into your home directory: "DAEMON=~/btsync"),
# then save this script as /etc/init.d/btsync
#
# Then type these two commands (the first one makes the script executable,
# the second one makes the script run at startup/shutdown):
#
# sudo chmod 755 /etc/init.d/btsync
# sudo update-rc.d btsync defaults
#
# To start btsync without rebooting, type:
#
# /etc/init.d/btsync start
#
# To stop it, type:
#
# /etc/init.d/btsync stop
#
set -e
PATH=/usr/local/bin:/usr/local/sbin:/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/local/bin/btsync/btsync
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting BitTorrent Sync" "btsync"
start-stop-daemon --start --oknodo --quiet --exec $DAEMON
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping BitTorrent Sync" "btsync"
start-stop-daemon --stop --oknodo --quiet --exec $DAEMON --retry=TERM/30/KILL/5
log_end_msg $?
;;
force-reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: /etc/init.d/btsync {start|stop|restart|force-reload}"
exit 1
;;
esac
exit 0
Then type these two commands (the first one makes the script executable, the second one makes the script run at startup/shutdown):
sudo chmod 755 /etc/init.d/btsync
sudo update-rc.d btsync defaults
That's it.
Test the script by typing:
/etc/init.d/btsync start
You should see BitTorrent Sync forked to background. pid = nnnnn. If you don't see that, it's probably because you did not set "DAEMON=" to the location of your btsync executable. Edit the /etc/init.d/btsync script to make sure.
Once BTSync is running, you shouldn't ever have to stop it. But if you want to, you can stop it manually by typing:
/etc/init.d/btsync stop
Some final notes:
- As written, the script will not start BTSync with a configuration file (because I don't use one, and I've already spent too much time on this tonight).
- The script runs BTSync as root, which is fine, but just on general principles I would prefer it to run as an unprivileged user. Again, though, it's late here and I'm too tired to experiment with btsync and see whether it functions correctly when invoked that way. Maybe tomorrow.
Related Content
NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!