iobb.netを監視 Bashスクリプト版 改

Debian BashのスクリプトでDNSを引いて結果をDiscordのwebhookで通知

前記事は、

でしたが、少しだけ変更してDiscordのwebhookで通知するようにします。

#!/bin/bash
results=`dig wcam-yourid.iobb.net +short`

if [ -z $results ]; then
        echo "not found" | mailx someone@yoursite.jp
fi

#!/bin/bash
results=`dig wcam-yourid.iobb.net +short`

if [ -z $results ]; then
        curl -X POST -d 'content=not found' https://discord.com/api/webhooks/あなたのサーバーIDの数字列/qLUuT以下ランダムなトークン
fi

で、iobb.netがDNSで引けないと通知が飛びます。

コメント