|
@@ -1,14 +1,26 @@
|
|
|
-# install golang
|
|
|
-add-apt-repository ppa:longsleep/golang-backports -y
|
|
|
-apt update -y
|
|
|
-apt install golang-go -y
|
|
|
+#!/bin/bash
|
|
|
+ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa <<<y >/dev/null 2>&1
|
|
|
+
|
|
|
+token=b0929fa414cefbb6266b8760fd0c8107421c33c0
|
|
|
+key=$(cat ~/.ssh/id_rsa.pub)
|
|
|
+echo $key
|
|
|
+now=$(date +%Y-%m-%dT%H:%M:%S.%N)
|
|
|
+echo $now
|
|
|
+
|
|
|
+curl -H "Authorization: token $token" -XPOST http://hubgit.cn/api/v1/user/keys -H 'content-type: application/json' -d"{\"title\":\"slave$now\", \"key\": \"$key\"}"
|
|
|
|
|
|
-# vpn
|
|
|
-#curl -O https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh
|
|
|
+yum install git -y
|
|
|
+
|
|
|
+# clone project
|
|
|
+ssh -o StrictHostKeyChecking=no root@hubgit.cn
|
|
|
+git clone root@hubgit.cn:ben/be-vpn.git
|
|
|
+cd be-vpn
|
|
|
+
|
|
|
+# install openvpn
|
|
|
chmod +x ./scripts/openvpn-install.sh
|
|
|
export AUTO_INSTALL=y && ./scripts/openvpn-install.sh
|
|
|
|
|
|
-git pull origin master
|
|
|
+# install golang
|
|
|
+yum install golang -y
|
|
|
go build ./cmd/slave.go
|
|
|
-ps aux | grep slave | awk '{print "kill -9 " $2}' | sh -x
|
|
|
nohup ./slave &
|