-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcc_mn_update.sh
96 lines (87 loc) · 2.96 KB
/
cc_mn_update.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
# This script will update your existing CampusCoin (CC) Masternode.
function cc_banner() {
echo -e "\e[32m"
cat << "EOF"
____ ____ _
/ ___|__ _ _ __ ___ _ __ _ _ ___ / ___|___ (_)_ __
| | / _` | '_ ` _ \| '_ \| | | / __| | / _ \| | '_ \
| |__| (_| | | | | | | |_) | |_| \__ \ |__| (_) | | | | |
\____\__,_|_| |_| |_| .__/ \__,_|___/\____\___/|_|_| |_|
|_|
EOF
echo -e "\e[0m"
}
function set_colors() {
RED="\033[38;5;196m"
GREEN="\033[38;5;46m"
BLUE="\033[34m"
NC="\033[0m"
}
function set_variables() {
CONFIGFOLDER="/root/.cc"
COIN_SNAPSHOT="https://www.dropbox.com/s/smrn0zwhkrhthrk/CC-SNAPSHOT-MAR08-2021-FULL-TO-BLK1777180.zip"
}
function stop_service() {
echo -e "${RED}Stopping CC MasterNode Service${NC}"
systemctl stop CampusCoin.service
cd /usr/local/bin/
}
function get_latest() {
echo -e "${GREEN}Retrieving latest Official CC Linux binary...${NC}"
wget -c https://github.com/campuscoindev/CC/releases/download/3.0.2.2/cc_linux.zip
}
function remove_old() {
echo -e "${RED}Removing old CC files...${NC}"
sudo rm ccd cc-cli cc-tx
sudo rm cc-qt
#######sudo rm -R ~/.cc/backups/
sudo rm -R ~/.cc/blocks/
sudo rm -R ~/.cc/chainstate/
sudo rm -R ~/.cc/database/
sudo rm ~/.cc/budget.dat ~/.cc/db.log ~/.cc/debug.log ~/.cc/fee_estimates.dat ~/.cc/mncache.dat ~/.cc/mnpayments.dat ~/.cc/peers.dat
}
function install_latest() {
echo -e "${GREEN}Extracting zip archive...${NC}"
sudo unzip cc_linux.zip
echo -e "${GREEN}Performing Cleanup...${NC}"
sudo rm cc_linux.zip
}
function get_snapshot() {
echo -e "${GREEN}Retrieve Latest Official CC Snapshot...${NC}"
TMP_FOLDER=$(mktemp -d)
cd $TMP_FOLDER
wget --progress=bar:force $COIN_SNAPSHOT 2>&1
unzip CC-SNAPSHOT-MAR08-2021-FULL-TO-BLK1777180.zip -d $CONFIGFOLDER/
cd -
rm -rf $TMP_FOLDER >/dev/null 2>&1
}
function start_service() {
echo -e "${GREEN}Starting CC Service..."
systemctl start CampusCoin.service
}
function finish() {
echo -e "${GREEN}CC Masternode Updated.${NC}"
echo -e "------------------------------------------------------------------"
echo -e "${BLUE}Useful Commands:${NC}"
echo -e "Use ${BLUE}cc-cli masternode status${NC} to check masternode status."
echo -e "Use ${BLUE}cc-cli mnsync status${NC} to check IsBlockchainSynced."
echo -e "Use ${BLUE}cc-cli getconnectioncount${NC} to check connections."
echo -e "Use ${BLUE}cc-cli getblockcount${NC} to view current block count."
echo -e "Use ${BLUE}cc-cli getinfo${NC} to view coin info."
echo -e "----------------------------------------------------------------------------------------------"
echo -e "\e[32mThank you for adding strength to the CampusCoin Community with your Updated CampusCoin MasterNode! \e[0m"
echo -e "----------------------------------------------------------------------------------------------"
}
# main
set_colors
cc_banner
set_variables
stop_service
remove_old
get_latest
install_latest
get_snapshot
start_service
finish
exit