From 2f85cf7c29adbd542d993d9f6f16f3163f1316ee Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Sat, 23 Jul 2022 18:55:31 +1000 Subject: [PATCH] remove 30 min cron job and simplify dockerfile --- Dockerfile | 3 +-- dockerfiles/README.md | 2 -- install/pialert.cron | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 02d225a6..33a47546 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,8 +29,7 @@ RUN groupadd --gid "${USER_GID}" "${USER}" && \ COPY . /home/pi/pialert # Pi.Alert -RUN sed -ie "s|TIMEZONE|${TZ}|g" /home/pi/pialert/install/pialert.cron \ - && python /home/pi/pialert/back/pialert.py update_vendors \ +RUN python /home/pi/pialert/back/pialert.py update_vendors \ && sed -ie 's/= 80/= '${PORT}'/g' /etc/lighttpd/lighttpd.conf \ && (crontab -l 2>/dev/null; cat /home/pi/pialert/install/pialert.cron) | crontab - diff --git a/dockerfiles/README.md b/dockerfiles/README.md index a9c266ca..17a4bbce 100644 --- a/dockerfiles/README.md +++ b/dockerfiles/README.md @@ -38,8 +38,6 @@ Default Port 4. Set the `TZ` environment variable to your current time zone (e.g.`Europe/Paris`). Find your time zone [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). 5. Database backup * The DB is stored under `/home/pi/pialert/db/pialert.db`. Map this file to a persistent location (see [Examples](https://github.com/jokob-sk/Pi.Alert/tree/main/dockerfiles#page_facing_up-examples) for details). If facing issues (AJAX errors, can't write to DB, etc, make sure permissions are set correctly, alternatively check the logs under `/home/pi/pialert/log`) - * Automated copy - The docker image copies the DB once every 30 min to `/home/pi/pialert/config/pialert.db_bak`. If you have a backup already available, make sure you rename this file if you want to keep older backups before starting a new container. To restore the DB run: `cp /home/pi/pialert/config/pialert.db_bak /home/pi/pialert/db/pialert.db` 6. The container supports mapping to local User nad Group IDs. Specify the enviroment variables `HOST_USER_ID` and `HOST_USER_GID` if needed. 7. You can override the port by specifying the `PORT` env variable. diff --git a/install/pialert.cron b/install/pialert.cron index a01b5861..4b4ece0b 100644 --- a/install/pialert.cron +++ b/install/pialert.cron @@ -7,9 +7,9 @@ # Puche 2021 pi.alert.application@gmail.com GNU GPLv3 #------------------------------------------------------------------------------- -TZ=TIMEZONE +TZ=Europe/London 0 3 * * 1 python /home/pi/pialert/back/pialert.py update_vendors >/home/pi/pialert/log/pialert.vendors.log 2>&1 */3 * * * * python /home/pi/pialert/back/pialert.py internet_IP >/home/pi/pialert/log/pialert.IP.log 2>&1 */5 * * * * python /home/pi/pialert/back/pialert.py 1 >/home/pi/pialert/log/pialert.1.log 2>&1 -*/30 * * * * cp /home/pi/pialert/db/pialert.db /home/pi/pialert/config/pialert.db_bak +