目前国内网盘相继关闭,BitTorrent作为一个替代者基本上可以满足我们的需求。选择一个运行Linux系统的NAS或者自己组装一台NAS,使用FreeBSD+ZFS(或者FreeNAS)作为24小时开机的同步源。其他PC上安装对应的版本通过KEY即可进行文件同步。

这里是使用FreeBSD作为主机的配置

在getsync.com获取最新的软件包

$ cd /home/jilili/Scripts
$ wget https://download-cdn.getsync.com/stable/FreeBSD-x64/BitTorrent-Sync_freebsd_x64.tar.gz
$ tar -zxvf BitTorrent-Sync_freebsd_x64.tar.gz

编辑启动脚本

# cd /usr/local/etc/rc.d
# touch btsync
# ee btsync

启动脚本

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
#
# PROVIDE: btsync
# REQUIRE: LOGIN DAEMON NETWORKING
# KEYWORD: shutdown
#
# To enable BTSync, add this line to your /etc/rc.conf:
#
# btsync_enable="YES"
#
# And optionally these line:
btsync_user="jilili" # Default is "root"
btsync_bin="/home/jilili/Scripts/btsync" # Default is "/usr/local/sbin/btsync"

. /etc/rc.subr                                                                                                

name="btsync"                                                                                                 
rcvar=btsync_enable                                                                                           

: ${btsync_enable="NO"}                                                                                       
: ${btsync_user="root"}                                                                                       
: ${btsync_bin="/usr/local/sbin/btsync"}                                                                      

command=$btsync_bin                                                                                           
command_args="--webui.listen 0.0.0.0:8888"                                                                    
start_cmd="${name}_start"                                                                                     

btsync_start() {
        echo "btsync start."
        su - ${btsync_user} -c "${command} ${command_args}"
        su - ${btsync_user} -c "pwd"
        if [ "$?" ]; then
                echo "Start ... OK"
                return 0
        else
                echo "Start ... FAILED"
                return 1
        fi
}

load_rc_config $name
run_rc_command "$1"

添加启动权限

# chmod ug+x /usr/local/etc/rc.d/btsync

调用启动脚本

# ee /etc/rc.conf
...
# BitTorrent Sync
btsync_enable="YES"

启动服务

/usr/local/etc/rc.d/btsync start

使用浏览器打开http://yourhost:8888,可进行操作。。。

[ 编辑 | 历史 ]
最近由“jilili”在“2016-09-02 16:03:40”修改