From e04ffb56f5a2a0e98ca7a67e9a140561a79618ce Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sat, 7 Jul 2018 13:50:23 +0100 Subject: [PATCH] Adds nameserver and site status i3 blocks --- i3/blocks/nameservers | 18 ++++++++++++++++++ i3/blocks/siteStatus | 10 ++++++++++ i3/i3blocks-secondary.conf | 10 ++++++++++ 3 files changed, 38 insertions(+) create mode 100755 i3/blocks/nameservers create mode 100755 i3/blocks/siteStatus diff --git a/i3/blocks/nameservers b/i3/blocks/nameservers new file mode 100755 index 00000000..0dbed38d --- /dev/null +++ b/i3/blocks/nameservers @@ -0,0 +1,18 @@ +#!/usr/bin/sh + +#drill ns racingblue.com | sed -ne '/ANSWER SECTION/,/AUTHORITY SECTION/ p' + +case $BLOCK_BUTTON in + 1) + echo "HI" + echo "HI" + echo "" + exit 0 + ;; +esac + +NAMESERVERS=$(drill ns "$1" | sed -ne '/ANSWER SECTION/,/AUTHORITY SECTION/ p' | head -n -2 | tail -n +2 | awk '{ print $5" " }' | xargs echo) + +echo "$NAMESERVERS" +echo "$NAMESERVERS" +echo "" diff --git a/i3/blocks/siteStatus b/i3/blocks/siteStatus new file mode 100755 index 00000000..c3db1359 --- /dev/null +++ b/i3/blocks/siteStatus @@ -0,0 +1,10 @@ +#!/usr/bin/env sh + +echo "$1" +echo "$1" +curl "$1" 2> /dev/null | grep -q "$2" +if [ $? -eq 0 ]; then + echo "#00FF00" +else + echo "#FF8000" +fi diff --git a/i3/i3blocks-secondary.conf b/i3/i3blocks-secondary.conf index b6a50d2a..99cf9ca8 100644 --- a/i3/i3blocks-secondary.conf +++ b/i3/i3blocks-secondary.conf @@ -42,6 +42,16 @@ command=xset -q | grep Caps 2> /dev/null | cut -c23 | sed "s/n/CAPS/" | sed "s/f signal=11 color=#00FF00 +#[nameservers] +#interval=5 +#command=~/.dotfiles/i3/blocks/nameservers domain.com +#label=Example Nameservers +# +#[siteStatis] +#interval=5 +#command=~/.dotfiles/i3/blocks/siteStatus https://www.domain.com "Something that should be found on a working request" + + [homeServerUpdates] interval=300 command=~/.dotfiles/i3/blocks/homeServerUpdates