Skip to content

Commit 692b7e3

Browse files
committed
replaced vpn keepalive
by reconnecting for every cronjob
1 parent b7acf41 commit 692b7e3

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

grades-docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ RUN pip install git+https://github.com/TINF21CS1/python-campusnet@dev
1111
COPY grades.sh /app/grades.sh
1212
RUN chmod 777 /app/grades.sh; chmod +x /app/grades.sh
1313
RUN crontab -l /cron
14-
RUN echo "0 7-23 * * * /bin/sh /app/grades.sh\n0/5 * * * * ping -c 4 www.google.com" >> /cron
14+
RUN echo "0 7-23 * * * /bin/sh /app/grades.sh" >> /cron
1515
RUN crontab /cron
1616
RUN rm /cron
1717

grades-docker/entrypoint.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ if [[ -z "${NOTIFY_RECIPIENT}" ]]; then
66
NOTIFY_RECIPIENT="${USERNAME}"
77
fi
88

9-
echo $PASSWORD | openconnect -b --user=$VPNUSERNAME --authgroup=$AUTHGROUP --passwd-on-stdin $HOST
10-
echo "$(date +"%b %d %H:%M:%S") $HOSTNAME entrypoint.sh[$$]: Started openconnect."
119
echo -e "root=${USERNAME}\nmailhub=studgate.dhbw-mannheim.de:25\nrewriteDomain=student.dhbw-mannheim.de\nhostname=campusnet.docker.local\nAuthUser=${USERNAME}\nAuthPass=${PASSWORD}\nAuthMethod=LOGIN\nFromLineOverride=yes" > /etc/ssmtp/ssmtp.conf
1210
echo -e "root:${USERNAME}:studgate.dhbw-mannheim.de:25" > /etc/ssmtp/revaliases
1311
echo "$(date +"%b %d %H:%M:%S") $HOSTNAME entrypoint.sh[$$]: Updated ssmtp configuration."

grades-docker/grades.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/bash
2+
3+
echo $PASSWORD | openconnect -b --user=$VPNUSERNAME --authgroup=$AUTHGROUP --passwd-on-stdin $HOST
4+
echo "$(date +"%b %d %H:%M:%S") $HOSTNAME grades.sh[$$]: Started openconnect in background."
25

36
python3 -m campusnet $USERNAME $PASSWORD -o table > /tmp/grades.txt
47
if [ ! -s grades.txt ]; then
@@ -12,4 +15,7 @@ if [ -s /tmp/diff.txt ]; then
1215
else
1316
echo "$(date +"%b %d %H:%M:%S") $HOSTNAME grades.sh[$$]: No changes detected."
1417
fi
15-
mv /tmp/grades.txt grades.tx
18+
mv /tmp/grades.txt grades.txt
19+
20+
/usr/bin/killall openconnect
21+
echo "$(date +"%b %d %H:%M:%S") $HOSTNAME grades.sh[$$]: Killed openconnect."

0 commit comments

Comments
 (0)