-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost_install.sh
63 lines (53 loc) · 1.72 KB
/
post_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
#!/bin/bash
DID_REPO=/home/elabox/elabox-binaries/binaries/did
ELA_REPO=/home/elabox/elabox-binaries/binaries/ela
BOOTSTRAPD_REPO=/home/elabox/elabox-binaries/binaries/ela-bootstrapd
BOOTSTRAPD_INPLACE=/home/elabox/supernode/carrier/ela-bootstrapd
DID_INPLACE=/home/elabox/supernode/did/did
ELA_INPLACE=/home/elabox/supernode/ela/ela
DID_REPO_HASH=`sha1sum ${DID_REPO} | awk '{print $1;}'`
ELA_REPO_HASH=`sha1sum ${ELA_REPO} | awk '{print $1;}'`
BOOTSTRAPD_REPO_HASH=`sha1sum ${BOOTSTRAPD_REPO} | awk '{print $1;}'`
BOOTSTRAPD_INPLACE_HASH=`sha1sum ${BOOTSTRAPD_INPLACE} | awk '{print $1;}'`
DID_INPLACE_HASH=`sha1sum ${DID_INPLACE} | awk '{print $1;}'`
ELA_INPLACE_HASH=`sha1sum ${ELA_INPLACE} | awk '{print $1;}'`
echo "Running post_install"
if [ "$DID_REPO_HASH" = "$DID_INPLACE_HASH" ]; then
echo "DID NO CHANGE"
else
echo "UPDATING DID"
pidof did
kill $(pidof did)
echo "KILLED DID"
sleep 30
rm ${DID_INPLACE}; cp ${DID_REPO} ${DID_INPLACE}
echo "UPDATED DID"
cd /home/elabox/supernode/did
nohup ./did > /dev/null 2>output &
echo "RESTARTED DID"
fi
if [ "$ELA_REPO_HASH" = "$ELA_INPLACE_HASH" ]; then
echo "ELA NO CHANGE"
else
echo "UPDATING ELA"
pidof ela
kill $(pidof ela)
echo "KILLED ELA"
sleep 30
rm ${ELA_INPLACE}; cp ${ELA_REPO} ${ELA_INPLACE}
echo "UPDATED ELA"
fi
if [ "$BOOTSTRAPD_REPO_HASH" = "$BOOTSTRAPD_INPLACE_HASH" ]; then
echo "BOOTSTRAPD NO CHANGE"
else
echo "UPDATING BOOTSTRAPD"
pidof ela-bootstrapd
kill $(pidof ela-bootstrapd)
echo "KILLED BOOTSTRAPD"
sleep 30
cp ${DID_REPO} ${DID_INPLACE}
echo "UPDATED BOOTSTRAPD"
cd /home/elabox/companion/src_server
node carrier.js
echo "RESTARTED BOOTSTRAPD"
fi