forked from chaos-zhu/easynode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
easynode-client-install-arm.sh
83 lines (63 loc) · 2.59 KB
/
easynode-client-install-arm.sh
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
if [ "$(id -u)" != "0" ] ; then
echo "***********************请切换到root再尝试执行***********************"
exit 1
fi
SERVER_NAME=easynode-client
FILE_PATH=/root/local/easynode-client
SERVICE_PATH=/etc/systemd/system
SERVER_VERSION=v1.0
echo "***********************开始安装 easynode-client_${SERVER_VERSION}***********************"
systemctl status ${SERVER_NAME} > /dev/null 2>&1
if [ $? != 4 ]
then
echo "***********************停用旧服务***********************"
systemctl stop ${SERVER_NAME}
systemctl disable ${SERVER_NAME}
systemctl daemon-reload
fi
if [ -f "${SERVICE_PATH}/${SERVER_NAME}.service" ]
then
echo "***********************移除旧服务***********************"
chmod 777 ${SERVICE_PATH}/${SERVER_NAME}.service
rm -Rf ${SERVICE_PATH}/${SERVER_NAME}.service
systemctl daemon-reload
fi
if [ -d ${FILE_PATH} ]
then
echo "***********************移除旧文件***********************"
chmod 777 ${FILE_PATH}
rm -Rf ${FILE_PATH}
fi
# 开始安装
echo "***********************创建文件PATH***********************"
mkdir -p ${FILE_PATH}
echo "***********************下载开始***********************"
DOWNLOAD_FILE_URL="https://ghproxy.com/https://github.com/chaos-zhu/easynode/releases/download/v1.1/easynode-client-arm"
DOWNLOAD_SERVICE_URL="https://ghproxy.com/https://raw.githubusercontent.com/chaos-zhu/easynode/v1.1/client/easynode-client.service"
# -O 指定路径和文件名(这里是二进制文件, 不需要扩展名)
wget -O ${FILE_PATH}/${SERVER_NAME} --no-check-certificate --no-cache ${DOWNLOAD_FILE_URL}
if [ $? != 0 ]
then
echo "***********************下载${SERVER_NAME}失败***********************"
exit 1
fi
wget -O ${FILE_PATH}/${SERVER_NAME}.service --no-check-certificate --no-cache ${DOWNLOAD_SERVICE_URL}
if [ $? != 0 ]
then
echo "***********************下载${SERVER_NAME}.service失败***********************"
exit 1
fi
echo "***********************下载成功***********************"
# echo "***********************设置权限***********************"
chmod +x ${FILE_PATH}/${SERVER_NAME}
chmod 777 ${FILE_PATH}/${SERVER_NAME}.service
# echo "***********************移动service&reload***********************"
mv ${FILE_PATH}/${SERVER_NAME}.service ${SERVICE_PATH}
# echo "***********************daemon-reload***********************"
systemctl daemon-reload
echo "***********************启动服务***********************"
systemctl start ${SERVER_NAME}
# echo "***********************设置开机启动***********************"
systemctl enable ${SERVER_NAME}
echo "***********************安装成功***********************"