xiaoz пре 7 година
комит
3a2a3a78ed
2 измењених фајлова са 67 додато и 0 уклоњено
  1. 26 0
      mysync.sh
  2. 41 0
      sync.sh

+ 26 - 0
mysync.sh

@@ -0,0 +1,26 @@
+#!/bin/bash
+############### 一键安装RslSync脚本 ###############
+#Author:xiaoz.me
+#Update:2017-03-27
+#Help:https://www.xiaoz.me/archives/8219
+####################### END #######################
+#获取rslsync pid
+chksync=$(pgrep 'rslsync')
+if [ "$1" == "start" ]
+	then
+		./rslsync --config sync.conf
+		echo "启动成功,请访问http://IP:8888/"
+	elif [ "$1" == "status" ]
+		then
+		if [ "$chksync" == "" ]
+			then
+				echo "Not running!"
+			else
+				echo "Is running,pid is ${chksync}"
+		fi
+	elif [ "$1" == "stop" ]
+		then
+			kill -9 ${chksync}
+	else
+		echo "参数错误!"
+	fi

+ 41 - 0
sync.sh

@@ -0,0 +1,41 @@
+#!/bin/bash
+############### 一键安装RslSync脚本 ###############
+#Author:xiaoz.me
+#Update:2017-03-27
+#Help:https://www.xiaoz.me/archives/8219
+####################### END #######################
+
+#搜索是否存在RslSync文件夹
+isf=$(find /home -name 'RslSync')
+#判断文件夹是否存在
+if [ "$isf" != "" ]
+	#已经存在
+	then
+		echo "Is already installed!"
+	#不存在,开始安装
+	else
+		mkdir -p /home/RslSync
+		cd /home/RslSync
+		wget https://soft.hixz.org/linux/resilio-sync_x64.tar.gz --no-check-certificate
+		tar -zxf resilio-sync_x64.tar.gz
+		rm -rf resilio-sync_x64.tar.gz
+		./rslsync --dump-sample-config > sync.conf 
+		declare user=$(cat sync.conf|grep 'login')
+		declare upass=$(cat sync.conf|grep ",\"password\"")
+		read -p "请输入用户名:" newuser
+		suser=${newuser}
+		declare newuser=",\"login\" : \"${newuser}\""
+		read -p "请设置密码:" newpass
+		spass=${newpass}
+		declare newpass=",\"password\" : \"${newpass}\""
+		sed -i "s%${user}%${newuser}%g" sync.conf
+		sed -i "s%${upass}%${newpass}%g" sync.conf
+		#设置alias
+		echo "alias mysync='/home/RslSync/mysync.sh'" >>  ~/.bashrc
+		./rslsync --config sync.conf
+		echo "############################# 安装成功 #############################"
+		echo "访问地址:http://IP:8888/"
+		echo "用户名:"${suser}
+		echo "密码:"${spass}
+		echo "帮助中心:https://www.xiaoz.me/archives/8219"
+	fi