-
Notifications
You must be signed in to change notification settings - Fork 0
/
services_status.1m.sh
executable file
·34 lines (29 loc) · 1.14 KB
/
services_status.1m.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
#!/bin/bash
# <bitbar.title>Services Status</bitbar.title>
# <bitbar.desc>Shows status of a selection of services from statuspage.io: Github, npm, RubyGems, and Cloudinary.</bitbar.desc>
# <bitbar.author>Alejandro AR</bitbar.author>
# <bitbar.author.github>kinduff</bitbar.author.github>
# <bitbar.version>1</bitbar.version>
status_urls=(
https://kctbh9vrtdwd.statuspage.io/api/v2/status.json # Github
https://wyvgptkd90hm.statuspage.io/api/v2/status.json # npm
https://pclby00q90vc.statuspage.io/api/v2/status.json # RubyGems
https://d8rszhl2bj7r.statuspage.io/api/v2/status.json # Cloudinary
)
top_status=()
bottom_status=()
for status_url in ${status_urls[@]}; do
request=`curl $status_url`
status=`echo ${request} | grep "All Systems Operational" | wc -l`
name=`echo ${request} | jq -r '.page.name'`
url=`echo ${request} | jq -r '.page.url'`
description=`echo ${request} | jq -r '.status.description'`
icon="🟢"
[[ "$status" -eq 0 ]] && icon="🔴"
top_status+=("${icon}")
bottom_status+=("${icon} ${name} - ${description} | href='${url}'")
done
printf '%s ' "${top_status[@]}"
echo
echo "---"
printf '%s\n' "${bottom_status[@]}"