forked from seatrips/lisk-network-reporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·57 lines (44 loc) · 988 Bytes
/
build.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
#!/bin/bash
# setup colors
red=`tput setaf 1`
green=`tput setaf 2`
cyan=`tput setaf 6`
bold=`tput bold`
reset=`tput sgr0`
heading()
{
echo
echo "${cyan}==>${reset}${bold} $1${reset}"
}
success()
{
echo
echo "${green}==>${bold} $1${reset}"
}
error()
{
echo
echo "${red}==>${bold} Error: $1${reset}"
}
heading "Installing..."
mkdir -p bin
mkdir -p logs
# update packages
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install -y software-properties-common
# install dependencies
sudo apt-get install -y software-properties-common build-essential git unzip wget nodejs npm ntp cloud-utils
# add node symlink if it doesn't exist
[[ ! -f /usr/bin/node ]] && sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install
sudo npm install pm2 -g
# set up time update cronjob
sudo bash -c "cat > /etc/cron.hourly/ntpdate << EOF
#!/bin/sh
pm2 flush
sudo service ntp stop
sudo ntpdate -s ntp.ubuntu.com
sudo service ntp start
EOF"
sudo chmod 755 /etc/cron.hourly/ntpdate