Running Bittorrent Sync As A Daemon On Os X


mlaster

Recommended Posts

I figured out how to get BT Sync running as a daemon, so wanted to post my findings.

 

I'm running 1.3.109 since 1.4 was too unreliable for me.

 

I create a directory in my home ~/Library/btsync_config to hold my config file:

 

~/Library/btsync_config> cat config.json

{
    "device_name": “Bittorrent Sync Daemon”,
    "listening_port": 0,
    "pid_file": "/private/tmp/bt.pid",
    "check_for_updates" : false,
    "use_gui" : false,
    "use_upnp" : true,
    
    "shared_folders" :
    [
        {
            "secret": "<SECRET_KEY>",
            "dir": "/Users/_USERNAME_/Shuttle",
            "use_relay_server": true,
            "use_tracker" : true,
            "use_dht" : true,
            "search_lan": true,
            "use_sync_trash": true
        }
    ]
}
 
Then I create a launchd plist to start BTSync as a daemon on boot
 
This file lives in /Library/LaunchDaemons:
 
/Library/LaunchDaemons> cat com.bitorrent.sync.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.bittorrent.sync</string>
<key>UserName</key>
<string>_USERNAME_</string>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>/private/tmp</string>
<key>ProgramArguments</key>
        <array>
<string>/Applications/BitTorrent Sync.app/Contents/MacOS/BitTorrent Sync</string>
<string>--config</string>
<string>/Users/_USERNAME_/Library/btsync_config/config.json</string>
</array>
</dict>
</plist>
 
Replace _USERNAME_ with your username so that BTSync runs as you (even when you aren't logged into the console)
 
Once this file is created, tell launchd to start it with
 
sudo launchctl load -w /Library/LaunchDaemons/com.bittorrent.sync.plist
 
This seems to be working for me on OS X Yosemite.
 
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.