initial commit
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
old.html
|
||||
21
Dockerfile
Normal file
21
Dockerfile
Normal file
@@ -0,0 +1,21 @@
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt update \
|
||||
&& apt -y upgrade\
|
||||
&& apt -y install \
|
||||
cron \
|
||||
tzdata \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN cp -r -f /usr/share/zoneinfo/Europe/Berlin /etc/localtime
|
||||
|
||||
COPY /wohn-hh-checker.sh /app/
|
||||
COPY /run.sh /app/
|
||||
COPY crontab /app/crontab
|
||||
|
||||
RUN chmod +x /app/run.sh
|
||||
RUN chmod +x /app/wohn-hh-checker.sh
|
||||
|
||||
CMD [ "/app/run.sh" ]
|
||||
2
crontab
Normal file
2
crontab
Normal file
@@ -0,0 +1,2 @@
|
||||
# m h dom mon dow cmd
|
||||
*/15 * * * * cd /app/ && ./wohn-hh-checker.sh &> /proc/1/fd/1
|
||||
7
run.sh
Normal file
7
run.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Wohn-HH-Checker Docker Container started!" > /proc/1/fd/1
|
||||
|
||||
crontab "/app/crontab"
|
||||
|
||||
cron -f
|
||||
29
wohn-hh-checker.sh
Executable file
29
wohn-hh-checker.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
mail="From: sockenklaus@gmail.com\n\
|
||||
To: pascalkoenig@duck.com\n\
|
||||
Subject: wohn-hh.de changed\n\
|
||||
\n\
|
||||
Visit: http://wohn-hh.de"
|
||||
|
||||
new=$(curl -s http://wohn-hh.de)
|
||||
|
||||
if [ -f "old.html" ]; then
|
||||
|
||||
old=$(<old.html)
|
||||
|
||||
if [[ "$old" != "$new" ]]; then
|
||||
curl -s --url 'smtps://smtp.gmail.com:465' \
|
||||
--ssl-reqd --mail-from 'sockenklaus@gmail.com' \
|
||||
--mail-rcpt 'pascalkoenig@duck.com' \
|
||||
--user 'sockenklaus@gmail.com:gkrybqzhzkkggbrh' \
|
||||
-T <(echo -e "$mail")
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$new" > old.html
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user