-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtools.sh
executable file
·38 lines (33 loc) · 972 Bytes
/
tools.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
#!/bin/bash
#set -xe
NC='\033[0m' # no color, reset
RED='\033[0;31m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
BLUE='\033[0;34m'
function runCommandWithUser() {
COINUSER=$1
COMMAND=$2
sudo -u $COINUSER -H sh -c "$COMMAND"
}
function runEvamppCall() {
path=$1
baseCmd="docker exec evmapp gosu user curl -sX POST http://127.0.0.1:9545/${path} -H 'accept: application/json' | jq -r ."
echo $($baseCmd)
}
function fail2banJailStatus() {
JAILS=($(sudo fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g'))
for JAIL in ${JAILS[@]}
do
echo -e "${RED}--------------- 👀 JAIL STATUS: $JAIL ... ---------------${NC}"
sudo fail2ban-client status $JAIL
echo -e "${RED}--------------- ... ---------------${NC}"
done
}
function mypublicip(){
ip=$(dig +short myip.opendns.com @resolver1.opendns.com)
if [ -z "$ip" ]; then
ip=$(curl -s ipinfo.io/ip)
fi
echo $ip
}