Skip to content

Instantly share code, notes, and snippets.

@ylansegal
Forked from Dehalion/README.md
Created Jun 11, 2013
Embed
What would you like to do?
BTSync Setup

####Go to temp dir $ cd /tmp ####Download your version of btsync i386 or x64 $ curl http://btsync.s3-website-us-east-1.amazonaws.com/btsync_i386.tar.gz -o btsync.tar.gz # i386 $ curl http://btsync.s3-website-us-east-1.amazonaws.com/btsync_x64.tar.gz -o btsync.tar.gz # x64 ####Then unpack this shit $ tar -xf btsync.tar.gz ####And move to your local bin $ sudo mv btsync /usr/local/bin/ ####Create a user and a group named btsync and give it a home folder ####Generate sample config $ btsync --dump-sample-config > /home/btsync ####Change "storage_path" to correct path $ nano /home/btsync ####Create service init script $ sudo touch /etc/init.d/btsync ####Set an executable $ sudo chmod +x /etc/init.d/btsync ####And put all shit from the bottom script to /etc/init.d/btsync $ sudo nano /etc/init.d/btsync ####Then test it $ sudo service btsync start

#! /bin/sh
### BEGIN INIT INFO
# Provides: btsync
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: btsync - Bittorent SyncApp
# Description: btsync - Bittorent SyncApp
### END INIT INFO
user="btsync"
group=`id -ng "$user"`
# the full path to the filename where you store your rtorrent configuration
config="/etc/btsync.conf"
# set of options to run with
options=""
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/btsync
DAEMON_ARGS="--config $config"
NAME=btsync
DESC="BitTorrent Sync"
test -x $DAEMON || exit 0
if [ -r /etc/default/$NAME ]
then
. /etc/default/$NAME
fi
set -e
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
if [ -n "$ULIMIT" ]
then
ulimit -n $ULIMIT
fi
if start-stop-daemon --start --quiet --oknodo --chuid $user:$group --exec $DAEMON -- $DAEMON_ARGS
then
log_end_msg 0
else
log_end_msg 1
fi
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
if start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
then
log_end_msg 0
else
log_end_msg 1
fi
sleep 1
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
${0} stop
${0} start
;;
status)
status_of_proc $DAEMON $NAME && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment