Compare commits

...

3 Commits

Author SHA1 Message Date
baeda13edd hosts list
array in source code or external file
2024-11-02 12:53:06 +01:00
ca572b13b4 Bugfix
when sending notification
2024-11-02 12:52:11 +01:00
71881ab882 Update README.md 2024-11-02 12:50:36 +01:00
3 changed files with 33 additions and 8 deletions

View File

@@ -8,13 +8,33 @@ Bash scripts to check whether a site is available or not, and whether the certif
Usage: urls_check.sh Usage: urls_check.sh
1. Check whether the certificate is valid or not, using <u>showcert</u> (pip install showcert) if available, else use <u>openssl.</u>
2. Check if the url is up or down with it's http_code.
Required the <u>urls_list.txt</u> file that contain a list of domains:
```bash
#https://notif.domain.com
#https://ntfy.domain.com
https://paperlessngx.domain.com
https://pastebin.domain.com
# comment line to disable checking this url
```
Required the <u>status.txt</u> file to give information about the http code returned.
```bash
302;Found;https://developer.mozilla.org/fr/docs/Web/HTTP/Status/302
```
#### 2) validity.sh #### 2) validity.sh
Usage: ./validity.sh Usage: ./validity.sh
Check whether the certificate is valid or not. Check whether the certificate is valid or not, using <u>showcert</u> (pip install showcert) if available, else use <u>openssl.</u>
Required the <u>validity_domains.txt</u> file that contain a list of domains: Required the <u>validity_domains.txt</u> file that contain a list of domains:
@@ -23,3 +43,4 @@ domain1.com
domain2.fr domain2.fr
``` ```
or edit the hosts() array in source code.

View File

@@ -80,6 +80,7 @@ send_gotify_notification() {
send_pushover_notification() { send_pushover_notification() {
echo -e "Sending Pushover notification ..." echo -e "Sending Pushover notification ..."
curl -S -s -o /dev/null -F "token=$BASH_APP" \ curl -S -s -o /dev/null -F "token=$BASH_APP" \
-F "user=$USER_KEY" \ -F "user=$USER_KEY" \
-F "title=$1" \ -F "title=$1" \
@@ -317,11 +318,11 @@ done
# Affichage des serveurs qui ne répondent pas # Affichage des serveurs qui ne répondent pas
if [ -f "./urls_down_list_curl.txt" ]; then if [ -f "./urls_down_list_curl.txt" ]; then
cp "./urls_down_list_curl.txt" urls_down_list_curl.bak
url_down=$(cat "./urls_down_list_curl.txt")
if [ "$x" -ne 1 ]; then if [ "$x" -ne 1 ]; then
echo -e "\n${redbold}Url down: ${reset}" echo -e "\n${redbold}Url down: ${reset}"
cp "./urls_down_list_curl.txt" urls_down_list_curl.bak
url_down=$(cat "./urls_down_list_curl.txt")
echo -e "$url_down" echo -e "$url_down"
# On affiche uniquement les erreurs rencontrées # On affiche uniquement les erreurs rencontrées

View File

@@ -46,11 +46,14 @@ ScriptArgs=( "$@" )
ScriptPath="$(readlink -f "$0")" # /Users/bruno/Documents/Scripts/bashbirds/bashbirds.sh ScriptPath="$(readlink -f "$0")" # /Users/bruno/Documents/Scripts/bashbirds/bashbirds.sh
ScriptWorkDir="$(dirname "$ScriptPath")" # /Users/bruno/Documents/Scripts/bashbirds ScriptWorkDir="$(dirname "$ScriptPath")" # /Users/bruno/Documents/Scripts/bashbirds
# Domains to check ### Domains to check ###
#hosts=("domain.com") #hosts=("domain.com")
if [ -f "$ScriptWorkDir/validity_domains.txt" ]; then hosts=("")
readarray -t hosts < "$ScriptWorkDir/validity_domains.txt" if [ ${#hosts[@]} -eq 0 ]; then
else echo -e "${red}No domain to check !${reset}" if [ -f "$ScriptWorkDir/validity_domains.txt" ]; then
readarray -t hosts < "$ScriptWorkDir/validity_domains.txt"
else echo -e "${red}No domain to check !${reset}"
fi
fi fi
port=443 port=443
# Days left before notification # Days left before notification