Skip to content

Instantly share code, notes, and snippets.

@P8H
Last active January 10, 2017 21:55
Show Gist options
  • Save P8H/379f5e48a66794311fefd86e74022d54 to your computer and use it in GitHub Desktop.
Save P8H/379f5e48a66794311fefd86e74022d54 to your computer and use it in GitHub Desktop.
#!/bin/bash
mkdir /etc/resilio
cd /etc/resilio
wget -N --no-check-certificate https://download-cdn.resilio.com/stable/linux-arm/resilio-sync_arm.tar.gz
tar xvzf resilio-sync_arm.tar.gz
rm resilio-sync_arm.tar.gz
wget -N --no-check-certificate https://gist.githubusercontent.com/P8H/379f5e48a66794311fefd86e74022d54/raw/resilio.conf
cd /etc/init.d/
wget -N --no-check-certificate https://gist.githubusercontent.com/P8H/379f5e48a66794311fefd86e74022d54/raw/resiliod
e
/etc/init.d/resiliod restart
{
"device_name": "MyCloud NAS",
// "listening_port" : 0, // 0 - randomize port
/* storage_path dir contains auxilliary app files if no storage_path field: .sync dir created in current working directory */
"storage_path" : "/mnt/HD",
/* set location of pid file */
"pid_file" : "/var/run/btsync.pid",
/* use UPnP for port mapping */
"use_upnp" : true,
/* limits in kB/s. 0 - no limit */
"download_limit" : 0,
"upload_limit" : 0,
/* proxy configuration */
// "proxy_type" : "socks4", // Valid types: "socks4", "socks5", "http_connect". Any other value means no proxy
// "proxy_addr" : "192.168.1.2", // IP address of proxy server.
// "proxy_port" : 1080,
// "proxy_auth" : false, // Use authentication for proxy. Note: only username/password for socks5 (RFC 1929) is supported, and it is not really secure
// "proxy_username" : "user",
// "proxy_password" : "password",
/* directory_root path defines where the WebUI Folder browser starts (linux only). Default value is / */
"directory_root" : "/mnt/HD",
/* directory_root_policy defines how directory_root is used (linux only).
Valid values are:
"all" - accepts directory_root and its subdirectories for 'getdir' and 'adddir' actions
"belowroot" - accepts directory_root's subdirectories for 'getdir' and 'adddir' actions,
but denies attempts to use 'adddir' to create directories directly within directory_root
Default value is "all". */
// "directory_root_policy" : "all",
"webui" :
{
"listen" : "0.0.0.0:8888" // remove field to disable WebUI
/* preset credentials. Use password or password_hash */
// ,"login" : "admin"
// ,"password" : "password"
// ,"password_hash" : "some_hash" // password hash in crypt(3) format
// ,"allow_empty_password" : false // Defaults to true
/* ssl configuration */
// ,"force_https" : true // disable http
// ,"ssl_certificate" : "/path/to/cert.pem"
// ,"ssl_private_key" : "/path/to/private.key"
/* dir_whitelist defines which directories can be shown to user or have folders added (linux only)
relative paths are relative to directory_root setting */
// ,"dir_whitelist" : [ "/home/user/MySharedFolders/personal", "work" ]
}
/* !!! if you set shared folders in config file WebUI will be DISABLED !!!
shared directories specified in config file override the folders previously added from WebUI. */
/*,
"shared_folders" :
[
{
"secret" : "MY_SECRET_1", // required field - use --generate-secret in command line to create new secret
"dir" : "/home/user/bittorrent/sync_test", // * required field
"use_relay_server" : true, // use relay server when direct connection fails
"use_tracker" : true,
"search_lan" : true,
"use_sync_trash" : true, // enable SyncArchive to store files deleted on remote devices
"overwrite_changes" : false, // restore modified files to original version, ONLY for Read-Only folders
"selective_sync" : false, // add folder in selective sync mode
"known_hosts" : // specify hosts to attempt connection without additional search
[
"192.168.1.2:44444"
]
}
]
*/
/* Advanced preferences can be added to config file. Info is available at "http://help.getsync.com/customer/portal/articles/1902048-sync-advanced-preferences--more-options"
For example see folder_rescan_interval below */
, "folder_rescan_interval" : 86400
}
#!/bin/sh
### BEGIN INIT INFO
# Provides: btsync
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Multi-user daemonized version of btsync.
# Description: Starts the btsync daemon for all registered users.
### END INIT INFO
DAEMON=/etc/resilio/rslsync
config=/etc/resilio/resilio.conf
start() {
if [ -f $config ]; then
echo "Starting BTSync"
start-stop-daemon -N 19 -I idle -b -o -c root -S -u root -x $DAEMON -- --config $config
else
echo "Couldn't start BTSync "
fi
}
stop() {
dbpid=`cat /var/run/btsync.pid`
if [ ! -z "$dbpid" ]; then
echo "Stopping btsync"
start-stop-daemon -o -c root -K -u root -x $DAEMON
fi
}
status() {
dbpid=`cat /var/run/btsync.pid`
if [ -z "$dbpid" ]; then
echo "btsync : not running."
else
echo "btsync : running (pid $dbpid)"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload|force-reload)
stop
start
;;
status)
status
;;
*)
echo "Usage: /etc/init.d/btsyncd {start|stop|reload|force-reload|restart|status}"
exit 1
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment