####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/
####Okey, generate sample config
$ btsync --dump-sample-config > ~/.btsync
####Change "storage_path"
to correct path, I'm use /home/andrii/.sync
, if u want too $ mkdir ~/.sync
$ nano ~/.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
, don't forget REPLACE MY USERNAME TO YOUR
$ sudo nano /etc/init.d/btsync
####Then test it
$ sudo service btsync start
Created
November 19, 2013 08:19
-
-
Save GarPit/7542025 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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="andrii" # YOU MUST REPLACE THIS BY YOUR USER | |
group=`id -ng "$user"` | |
# the full path to the filename where you store your rtorrent configuration | |
config="`su -c 'echo $HOME' $user`/.btsync" | |
# 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=btsync | |
RUNDIR=/var/run/syncapp | |
PIDFILE=$RUNDIR/syncapp.pid | |
test -x $DAEMON || exit 0 | |
if [ -r /etc/default/$NAME ] | |
then | |
. /etc/default/$NAME | |
fi | |
set -e | |
case "$1" in | |
start) | |
echo -n "Starting $DESC: " | |
mkdir -p $RUNDIR | |
touch $PIDFILE | |
chown $user:$group $RUNDIR $PIDFILE | |
chmod 755 $RUNDIR | |
if [ -n "$ULIMIT" ] | |
then | |
ulimit -n $ULIMIT | |
fi | |
if start-stop-daemon --start --quiet --umask 007 --pidfile $PIDFILE --chuid $user:$group --exec $DAEMON -- $DAEMON_ARGS | |
then | |
echo "$NAME." | |
else | |
echo "failed" | |
fi | |
;; | |
stop) | |
echo -n "Stopping $DESC: " | |
if start-stop-daemon --stop --retry forever/TERM/1 --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON | |
then | |
echo "$NAME." | |
else | |
echo "failed" | |
fi | |
rm -f $PIDFILE | |
sleep 1 | |
;; | |
restart|force-reload) | |
${0} stop | |
${0} start | |
;; | |
status) | |
echo -n "$DESC is " | |
if start-stop-daemon --stop --quiet --signal 0 --name ${NAME} --pidfile ${PIDFILE} | |
then | |
echo "running" | |
else | |
echo "not running" | |
exit 1 | |
fi | |
;; | |
*) | |
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