forked from coincashew/EthPillar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resync_execution.sh
executable file
·85 lines (77 loc) · 1.87 KB
/
resync_execution.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
#!/bin/bash
# Author: coincashew.eth | coincashew.com
# License: GNU GPL
# Source: https://github.com/coincashew
#
# Made for home and solo stakers 🏠🥩
BASE_DIR=$(pwd)
function getClient(){
EL=$(cat /etc/systemd/system/execution.service | grep Description= | awk -F'=' '{print $2}' | awk '{print $1}')
}
function promptYesNo(){
case $EL in
Nethermind)
MSG="This will take a few hours."
;;
*)
MSG="This will about a day or so."
;;
esac
if whiptail --title "Resync Execution - $EL" --yesno "$MSG\nConsider configuring a RescueNode to minimize downtime.\nAre you sure you want to resync $EL?" 10 78; then
resyncClient
promptViewLogs
fi
}
function promptViewLogs(){
if whiptail --title "Resync $EL started" --yesno "Would you like to view logs and confirm everything is running properly?" 8 78; then
sudo bash -c 'journalctl -fu execution | ccze -A'
fi
}
function resyncClient(){
clear
case $EL in
Nethermind)
sudo systemctl stop execution
sudo rm -rf /var/lib/nethermind/*
sudo systemctl restart execution
;;
Besu)
sudo systemctl stop execution
sudo rm -rf /var/lib/besu/*
sudo systemctl restart execution
;;
Geth)
sudo systemctl stop execution
sudo rm -rf /var/lib/geth/*
sudo systemctl restart execution
;;
Erigon)
sudo systemctl stop execution
sudo rm -rf /var/lib/erigon/*
sudo systemctl restart execution
;;
Reth)
sudo systemctl stop execution
sudo rm -rf /var/lib/reth/*
sudo systemctl restart execution
;;
esac
}
function setWhiptailColors(){
export NEWT_COLORS='root=,black
border=green,black
title=green,black
roottext=red,black
window=red,black
textbox=white,black
button=black,green
compactbutton=white,black
listbox=white,black
actlistbox=black,white
actsellistbox=black,green
checkbox=green,black
actcheckbox=black,green'
}
setWhiptailColors
getClient
promptYesNo