-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstep_3.sh
78 lines (67 loc) · 2.86 KB
/
step_3.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
cd /tmp/
wget https://github.com/dashpay/dash/releases/download/v0.16.0.1/dashcore-0.16.0.1-x86_64-linux-gnu.tar.gz
sudo bash -c "cd /opt&& rm -f dash 2>/dev/null;tar xvf /tmp/dashcore-0.16.0.1-x86_64-linux-gnu.tar.gz&& ln -s dashcore-0.16.0 dash"
sudo bash -c "echo -e \"MANPATH_MAP\t/opt/dash/bin\t\t/opt/dash/share/man\">>/etc/manpath.config"
sudo bash -c "echo 'PATH=/opt/dash/bin:\$PATH'>>/home/dash/.profile"
sudo -u dash bash -c "mkdir -p /home/dash/.dashcore&&cat >/home/dash/.dashcore/dash.conf<<\"EOF\"
#----
rpcuser=rpcuser$(< /dev/urandom tr -dc A-Za-z0-9 | head -c${1:-8};echo)
rpcpassword=rpcpassword$(< /dev/urandom tr -dc A-Za-z0-9 | head -c${1:-8};echo)
rpcallowip=127.0.0.1
#----
listen=1
server=1
daemon=1
#----
masternodeblsprivkey=XXXXXXXXXXXXXXXXXXXXXX
externalip=$(wget -qO- http://ipecho.net/plain)
#----
EOF"
sudo -i -u dash bash -c "nano ~/.dashcore/dash.conf"
sudo mkdir -p /etc/systemd/system&&\
sudo bash -c "cat >/etc/systemd/system/dashd.service<<\"EOF\"
[Unit]
Description=Dash Core Daemon
After=syslog.target network-online.target
# Notes:
#
# Watch the daemon service actions in the syslog journal with:
# sudo journalctl -u dashd.service -f
[Service]
Type=forking
User=dash
Group=dash
# Make dashd less likely to be killed when RAM is low.
OOMScoreAdjust=-1000
ExecStart=/opt/dash/bin/dashd -pid=/home/dash/.dashcore/dashd.pid
# Time that systemd gives a process to start before shooting it in the head
TimeoutStartSec=10m
# If ExecStop is not set, systemd sends a SIGTERM, which is \"okay\", just not ideal
ExecStop=/opt/dash/bin/dash-cli stop
# Time that systemd gives a process to stop before shooting it in the head
TimeoutStopSec=120
Restart=on-failure
# If something triggers an auto-restart, let's wait a bit before taking further action
# Note: This value is in addition to the stop sleep time
RestartSec=120
# In this interval span of time, we allow systemd to start dashd "burst" number
# of times. With Dash we really only want one instance started, so... let's
# really limit this. But we want to give systemd some room to attempt to
# correct things. To be honest, I think the way things are configured between
# these settings and TimeoutStartSec, only one instance will be initiated.
StartLimitInterval=300
StartLimitBurst=3
[Install]
WantedBy=multi-user.target
# Really useful:
# * https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files
# * https://www.freedesktop.org/software/systemd/man/systemd.service.html
# * man systemd, man systemd.service, and man systemd.unit
EOF"
sudo systemctl daemon-reload &&\
sudo systemctl enable dashd &&\
sudo systemctl start dashd &&\
echo "Dash is now installed as a system service and initializing..."
#systemctl status dashd.service
echo "Checking journalctl use ctrl+c to exit and continue. Please follow the instructions in the manual after exiting."
sudo journalctl -u dashd.service -f