-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
69 lines (51 loc) · 1.4 KB
/
install.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
#!/bin/bash
if [ "$(id -u)" -eq 0 ]; then
echo "current user is root, please login system with user not root."
exit 0
fi
homepath=$HOME
curuser=$USER
mkdir -p $HOME/.ssh
sudo chmod 700 $HOME/.ssh
curuser=$USER
echo "HOME path:$homepath"
echo "Current User:$curuser"
SUDODESC="$curuser ALL=(ALL:ALL) NOPASSWD:ALL"
sudo chmod 555 /etc/sudoers
sudo echo $SUDODESC | sudo tee -a /etc/sudoers
sudo chmod 440 /etc/sudoers
rootpath=/usr/cg
sudo mkdir -p $rootpath
sudo chmod a+rwx $rootpath
if [ -f "$rootpath/bm.tar.gz" ]; then
rm -f $rootpath/bm.tar.gz
fi
sudo systemctl stop bm-agent
sudo wget https://mini-arsdog.s3.ap-southeast-1.amazonaws.com/ZBJ_TEST/testnet/1.7.5/bm-1.7.5.5.61470c9.tar.gz -O $rootpath/bm.tar.gz
if [ -f "$rootpath/bm.tar.gz" ]; then
echo "download file success"
else
echo "download failed!"
exit 0
fi
tar -zxvf $rootpath/bm.tar.gz -C $rootpath
if [ -f "$rootpath/bm/bm-agent" ]; then
echo "unpress package success"
else
echo "unpress failed!"
exit 0
fi
sudo chmod -R a+rwx $rootpath/bm
if [ $# -eq 3 ]; then
sudo $rootpath/bm/run.sh $1 $2 $3 $homepath
elif [ $# -eq 4 ]; then
sudo $rootpath/bm/run.sh $1 $2 $3 $homepath $4
else
echo "param error"
fi
if ps aux | grep -v grep | grep "bm-agent" >/dev/null; then
echo "bm-agent service is running..."
else
echo "bm-agent service start failed"
fi
echo "bm-agent install successful"