Running BitTorrent Sync on Fedora 19 as a service

While setting up BitTorrent Sync (BTSync) on my Fedora 19 workstation at work I thought it’s about time for me to find a recipe on how to setup BTsync as systemd service. So far I start up BTsync manually via simple alias in bashrc, something like this:

alias startbtsync='~/BTSync/btsync --config ~/BTSync/btsync.conf'

Stopping was not as easy, since I had to remember BTsync PID (or grep ps -aux for it) and then use kill command. Thanks to jcollie post on BitTorrent Sync setting service for Btsync was a breeze. But let’s first see how I actually installed BTSync.

Make sure that you pick the latest build from Forum topic that is pinned at the top and is meant to announce the latest build with the proper link. Do NOT download BTSync from the front home page if you wish to work with the latest version with the least amount of bugs.

Installation was as easy as:

$ sudo tar -C /usr/local/bin -xvzf btsync_x64-1.2.71.tar.gz

I also created my “personal” BTsync config file:

$ mkdir ~/BTSync
$ /usr/local/bin/btsync --dump-sample-config > ~/BTSync/btsync.conf

The only thing that I changed was listen address, login name and password:

"webui" :
    "listen" : "",
    "login" : "admin",
    "password" : "password"

You can setup other options but this is out of the scope of this post. Let’s see now how can we start btsync as a service for one or more users of local workstation.

:: create config file for the service...
$ sudo nano /etc/systemd/system/btsync@.service

Description=BTSync for %i

ExecStart=/usr/local/bin/btsync --nodaemon --config %h/BTSync/btsync.conf


Now, we can start/stop Btsync as a service:

:: Start BTSync
$ sudo systemctl start btsync@alesk.service

:: Stop BTSync
$ sudo systemctl stop btsync@alesk.service

:: Status 
$ sudo systemctl status btsync@alesk.service

:: Restart
$ sudo systemctl restart btsync@alesk.service

:: Autostart at boot
$ sudo systemctl enable btsync@alesk.service

:: Disable at boot
$ sudo systemctl disable btsync@alesk.service

Equivalently I added the following aliases in my .bashrc:

alias startbtsync='sudo systemctl start btsync@alesk.service'
alias stopbtsync='sudo systemctl stop btsync@alesk.service'
alias statusbtsync='sudo systemctl status btsync@alesk.service'
alias restartbtsync='sudo systemctl restart btsync@alesk.service' 

Getting status of Btsync from command line is now much easier:


Posted on 13.11.2013, in Linux, PostgreSQL, etc. and tagged . Bookmark the permalink. Comments Off on Running BitTorrent Sync on Fedora 19 as a service.

Comments are closed.