-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
73 lines (55 loc) · 1.61 KB
/
Makefile
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
SHELL=/usr/bin/env bash
ifndef GIT_ORG
GIT_ORG = sirouk
endif
ifndef GIT_REPO
GIT_REPO = quilibrium-node-exporter
endif
ifndef SOURCE_PATH
SOURCE_PATH=~/quilibrium-node-exporter
endif
ifndef REPO_PATH
REPO_PATH=~/${GIT_REPO}
endif
check:
cd ${SOURCE_PATH}
ls
curl 127.0.0.1:8380/metrics
install:
cd ${SOURCE_PATH}
sudo apt install -y python3 python3-pip jq
python3 -m pip install flask
python3 -m pip install base58
@if [ ! -d ${REPO_PATH} ]; then \
mkdir -p ${REPO_PATH} && cd ${REPO_PATH} && git clone https://github.com/${GIT_ORG}/${GIT_REPO} .; \
elif [ -d ${REPO_PATH}/.git ]; then \
cd ${REPO_PATH}; \
else \
echo "Directory exists but is not a git repository. Please handle manually."; \
fi
update: install
cd ${REPO_PATH}
git pull
start-exporter:
cd ${SOURCE_PATH} && python3 quilibrium-node-exporter.py
start-cron:
@cd ${REPO_PATH}; \
ps aux | grep "python3 quilibrium-node-exporter.py" | grep -v "grep" > /dev/null; \
ps_exit_status=$$?; \
if [ $$ps_exit_status -ne 0 ]; then \
echo "Starting Quilibrium Node Exporter..."; \
cd ${REPO_PATH} && make start-exporter >> ${REPO_PATH}/exporter.log 2>&1 & \
else \
echo "Quilibrium Node Exporter is already running"; \
fi
stop-cron:
@cd ${REPO_PATH}; \
ps aux | grep "python3 quilibrium-node-exporter.py" | grep -v "grep" > /dev/null; \
ps_exit_status=$$?; \
if [ $$ps_exit_status -ne 0 ]; then \
echo "Quilibrium Node Exporter is not running!"; \
cd ${REPO_PATH} && make start-exporter >> ${REPO_PATH}/exporter.log 2>&1 & \
else \
echo "Stopping Quilibrium Node Exporter..."; \
pkill -f "python3 quilibrium-node-exporter.py"; \
fi