feat: added isalivescript with variables.
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
.env
|
||||||
|
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -0,0 +1 @@
|
|||||||
|
.env
|
||||||
|
|||||||
18
DOCKERFILE
18
DOCKERFILE
@@ -0,0 +1,18 @@
|
|||||||
|
FROM debian
|
||||||
|
|
||||||
|
ENV WEBSITES=("google.com" "yahoo.com")
|
||||||
|
|
||||||
|
ENV WEBHOOK_URL=""
|
||||||
|
|
||||||
|
ENV DISCORD_ID=""
|
||||||
|
|
||||||
|
RUN apt update && apt install -y \
|
||||||
|
bash \
|
||||||
|
curl \
|
||||||
|
cron \
|
||||||
|
|
||||||
|
COPY ./start.sh /start.sh
|
||||||
|
|
||||||
|
CMD ["/start.sh"]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
26
isalive.sh
Normal file
26
isalive.sh
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# List of websites to monitor
|
||||||
|
websites=$WEBSITES
|
||||||
|
|
||||||
|
# Discord Webhook URL
|
||||||
|
webhook_url=$WEBHOOK_URL
|
||||||
|
|
||||||
|
# Function to send a message to Discord webhook
|
||||||
|
send_discord_notification() {
|
||||||
|
local message=$1
|
||||||
|
curl -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\": \"$message\"}" \
|
||||||
|
"$webhook_url"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Loop through the websites and check their status
|
||||||
|
for website in "${websites[@]}"; do
|
||||||
|
response=$(curl -s -o /dev/null -L -w "%{http_code}" --max-time 10 --connect-timeout 5 --insecure "$website")
|
||||||
|
|
||||||
|
if [ "$response" != "200" ]; then
|
||||||
|
send_discord_notification "$DISCORD_ID Alert: Website $website is down (HTTP $response)"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
Reference in New Issue
Block a user