Skip to content

Commit

Permalink
Merge pull request #191 from silversword411/main
Browse files Browse the repository at this point in the history
missed one From Discord #scripts Thanks Stefan!
  • Loading branch information
silversword411 authored Oct 29, 2023
2 parents 7b58891 + e4d04ad commit eafbbdf
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions scripts_wip/linux_website_keywordmonitor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
#
# With love from Stefan Lousberg 10/29/2023
# Env Var: URL=https://www.google.nl
# Args: words
#

# URL to monitor (specified as an environment variable)
URL="$URL"

# Keywords to monitor for (passed as script arguments)
KEYWORDS=("$@")

# Perform the cURL request and store the page content in a variable
PAGE_CONTENT=$(curl -s "$URL")

found_all_keywords=1

# Loop through each keyword and check if it exists in the page content
for keyword in "${KEYWORDS[@]}"; do
if [[ $PAGE_CONTENT != *"$keyword"* ]]; then
echo "Keyword '$keyword' not found on $URL"
found_all_keywords=0
fi
done

if [ "$found_all_keywords" -eq 1 ]; then
echo "All keywords found on $URL"
exit 0
else
exit 1
fi

0 comments on commit eafbbdf

Please sign in to comment.