Skip to content

Commit 26a699a

Browse files
committed
Corrected the backup script for Terra 2.
- Added a few new commands for `terrad`.
1 parent 3815baa commit 26a699a

File tree

2 files changed

+37
-13
lines changed

2 files changed

+37
-13
lines changed

commands/README.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ pip install --user glances
1111

1212
## Logging
1313

14-
### Gets the log output of a service ###
14+
### Gets the log output of a service
1515

1616
`journalctl -u price-server.service -f`
1717

1818
Note that if the service is running at a "system" level, there may be a need to use `sudo` with the command.
1919

20-
### List the logs since a specific time ###
20+
### List the logs since a specific time
2121

2222
`journalctl -u feeder.service --since "2021-12-09 20:00:00"`
2323

2424
`journalctl -S "4 hour ago"`
2525

26-
### List the logs until a specific time ###
26+
### List the logs until a specific time
2727

2828
`journalctl --until "2022-02-24 01:23:00`
2929

30-
### List the logs only from the current boot ###
30+
### List the logs only from the current boot
3131

3232
`journalctl -u service-name.service -b`
3333

@@ -67,3 +67,27 @@ sudo systemctl enable cosmos.service
6767
### Check disk performance
6868

6969
`sudo hdparm -tT /dev/disk/by-id/scsi-0DO_Volume_columbus5a`
70+
71+
### Get the SHA256 hash of a file
72+
73+
```bash
74+
jq -S -c -M '' genesis.json | shasum -a 256
75+
```
76+
77+
### Snippet to view consensus state
78+
79+
```bash
80+
while true; do curl http://localhost:26657/consensus_state | jq '.result.round_state.height_vote_set[0].prevotes_bit_array'; curl http://localhost:26657/dump_consensus_state | jq '.result.round_state.votes[0].prevotes' | grep $(curl -s http://localhost:26657/status | jq -r '.result.validator_info.address[:12]'); sleep 3; echo ----; done
81+
```
82+
83+
### Generate the operator address from the wallet key.
84+
85+
```bash
86+
terrad keys show KEY_NAME --bech val --home ~/.terra --output json | jq -r .address
87+
```
88+
89+
### List the validators in order of voting power
90+
91+
terrad --node http://localhost:26657 query staking validators --limit 1000 -o json | jq -r '.validators[] | [.operator_address, .status, (.tokens|tonumber / pow(10; 6)), .description.moniker] | @csv' | column -t -s"," | sort -k3 -n -r | nl
92+
93+
(Reference: https://discord.com/channels/976127574252060703/976143280800661524/979992980091969546)

terra/scripts/backup.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@ USER_TERRA=
55
SERVER_TERRA=
66
SSH_PORT=22
77

8-
BU_TERRA_FOLDER=./backup/terra-validator4/
8+
BU_TERRA_FOLDER=./backup/terra2-validator2/
99
BU_TERRA_CONFIG=${BU_TERRA_FOLDER}config/
10-
BU_TERRA_PRICE=${BU_TERRA_FOLDER}price-server/
11-
BU_TERRA_FEEDER=${BU_TERRA_FOLDER}feeder/
10+
# BU_TERRA_PRICE=${BU_TERRA_FOLDER}price-server/
11+
# BU_TERRA_FEEDER=${BU_TERRA_FOLDER}feeder/
1212

1313
mkdir -p $BU_TERRA_CONFIG
14-
mkdir -p $BU_TERRA_PRICE
15-
mkdir -p $BU_TERRA_FEEDER
14+
# mkdir -p $BU_TERRA_PRICE
15+
# mkdir -p $BU_TERRA_FEEDER
1616

1717
#Backup .terra folder.
1818
rsync $USER_TERRA@$SERVER_TERRA:.terra/config/ $BU_TERRA_CONFIG -e "ssh -p $SSH_PORT" --delete --exclude-from=../excludes.txt -vzrc
1919
#Copy the validator key separately.
2020
rsync $USER_TERRA@$SERVER_TERRA:.terra/config/priv_validator_key.json $BU_TERRA_FOLDER -e "ssh -p $SSH_PORT" -vzc
2121

2222
#Backup price server
23-
rsync $USER_TERRA@$SERVER_TERRA:oracle-feeder/price-server/config/default.js $BU_TERRA_PRICE -e "ssh -p $SSH_PORT" -vzrc
23+
# rsync $USER_TERRA@$SERVER_TERRA:oracle-feeder/price-server/config/default.js $BU_TERRA_PRICE -e "ssh -p $SSH_PORT" -vzrc
2424

2525
#Backup oracle feeder
26-
rsync $USER_TERRA@$SERVER_TERRA:oracle-feeder/feeder/voter.json $BU_TERRA_FEEDER -e "ssh -p $SSH_PORT" -vzrc
26+
# rsync $USER_TERRA@$SERVER_TERRA:oracle-feeder/feeder/voter.json $BU_TERRA_FEEDER -e "ssh -p $SSH_PORT" -vzrc
2727

2828
#Backup the system configuration files.
29-
rsync $USER_TERRA@$SERVER_TERRA:/etc/systemd/system/price-server.service $BU_TERRA_FOLDER -e "ssh -p $SSH_PORT" -vzc
30-
rsync $USER_TERRA@$SERVER_TERRA:/etc/systemd/system/feeder.service $BU_TERRA_FOLDER -e "ssh -p $SSH_PORT" -vzc
29+
# rsync $USER_TERRA@$SERVER_TERRA:/etc/systemd/system/price-server.service $BU_TERRA_FOLDER -e "ssh -p $SSH_PORT" -vzc
30+
# rsync $USER_TERRA@$SERVER_TERRA:/etc/systemd/system/feeder.service $BU_TERRA_FOLDER -e "ssh -p $SSH_PORT" -vzc
3131
rsync $USER_TERRA@$SERVER_TERRA:/etc/systemd/system/terrad.service $BU_TERRA_FOLDER -e "ssh -p $SSH_PORT" -vzc

0 commit comments

Comments
 (0)