-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·48 lines (34 loc) · 1.37 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
#!/bin/sh
IP=`ip addr | grep -v -w "lo" | grep -Eo 'inet [0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}' | awk '{ print $2 }' | head -1`
host=$(hostname)
read -p " |-> Your server IP: default [ "$IP" ]: " ServIP
: ${ServIP:=$IP}
read -p " |-> You cluster name: default [ sysbackup cluster ]: " cluster
: ${cluster:="sysbackup cluster"}
read -p " |-> You node name: default [ "$host" ]: " node
: ${node:=$host}
echo "Start installing the server backup"
if [ ! -d /etc/sbd ]; then { mkdir -p /etc/sbd; } fi
cp sbd.ini /etc/sbd/
echo "Install sbd"
cp dist/sbd /usr/sbin/sbd
cp lib/SB.py /usr/lib/python2.7/
echo "install sbctl"
cp dist/sbctl /usr/sbin/sbctl
echo "create systemd unit"
cp sbd.service /etc/systemd/system/
systemctl daemon-reload
cp sbd.logrotate /etc/logrotate.d/
if [ ! -d /usr/share/sbcl ]; then { mkdir -p /usr/share/sbcl; } fi
cp dist/sbcl /usr/share/sbcl/
cp sbcl.ini /usr/share/sbcl/
sed -i "s/127\.0\.0\.1/$ServIP/" /usr/share/sbcl/sbcl
sed -i "s/127\.0\.0\.1/$ServIP/" /usr/share/sbcl/sbcl.ini
sed -i "s/127\.0\.0\.1/$ServIP/" /etc/sbd/sbd.ini
sed -i "s/yourcluster/$cluster/" /etc/sbd/sbd.ini
sed -i "s/hostname/$host/" /etc/sbd/sbd.ini
echo "Sysbackup has been installed. You can start and stop by using systemd; systemctl status sbd "
echo "Configuration file: /etc/sbd/sbd.ini"
echo "Your configuration parameters"
mkdir /var/log/sbd
cat /etc/sbd/sbd.ini