forked from maltfield/awesome-lemmy-instances
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-age.sh
executable file
·42 lines (31 loc) · 862 Bytes
/
get-age.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
#!/bin/sh
set -x
############
# SETTINGS #
############
OUTPUT_FILE='age.json'
#####################
# DECLARE VARIABLES #
#####################
# get the current branch of the 'awesome-lemmy-instances' repo
current_branch=$(git branch --show-current)
#############
# FUNCTIONS #
#############
FATAL() {
printf 'FATAL: %s. Aborting.\n' "$*"
exit 1
}
#############
# API QUERY #
#############
# some pre-run output for debugging
ls -lah
curl 'https://api.fediverse.observer/' -X POST -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Content-Type: application/json' --data-raw '{"query":"query{\n nodes (softwarename: \"lemmy\") {\ndomain monthsmonitored\n }\n}\n"}' > "${OUTPUT_FILE}"
# some post-run output for debugging
ls -lah
du -sh *
wc -l "${OUTPUT_FILE}"
head --bytes 1024 "${OUTPUT_FILE}"
tail --bytes 1024 "${OUTPUT_FILE}"
exit 0