diff --git a/urlwatch/Dockerfile b/urlwatch/Dockerfile index 179aeda..1db9a7c 100644 --- a/urlwatch/Dockerfile +++ b/urlwatch/Dockerfile @@ -38,3 +38,5 @@ VOLUME /root/.urlwatch WORKDIR /root/.urlwatch CMD ["crond", "-f", "-L", "/dev/stdout"] + +VOLUME /etc/crontabs/root \ No newline at end of file diff --git a/urlwatch/README.md b/urlwatch/README.md index 3b4def3..c7a836a 100644 --- a/urlwatch/README.md +++ b/urlwatch/README.md @@ -49,3 +49,25 @@ v3.2.5 ``` [1]: https://thp.io/2008/urlwatch/ + +## customizing cron schedule + +### Create a crontab file + +``` +*/30 * * * * cd /root/.urlwatch && urlwatch --urls urls.yaml --config urlwatch.yaml --hooks hooks.py --cache cache.db +*/15 * * * * cd /root/.urlwatch && urlwatch --urls urls-every-15m.yaml --config urlwatch.yaml --hooks hooks.py --cache cache.db +``` + +See the [crontab manpage for details on format](https://man7.org/linux/man-pages/man5/crontab.5.html#DESCRIPTION). + +### Mount the crontab file as a docker volume + +```yaml +urlwatch: + image: vimagick/urlwatch + volumes: + - ./data:/root/.urlwatch + - ./crontabs/root:/etc/crontabs/root + restart: unless-stopped +``` \ No newline at end of file diff --git a/urlwatch/data/crontab b/urlwatch/data/crontab new file mode 100644 index 0000000..48dd6ff --- /dev/null +++ b/urlwatch/data/crontab @@ -0,0 +1 @@ +*/30 * * * * cd /root/.urlwatch && urlwatch --urls urls.yaml --config urlwatch.yaml --hooks hooks.py --cache cache.db \ No newline at end of file diff --git a/urlwatch/docker-compose.yml b/urlwatch/docker-compose.yml index d3db538..9893fe6 100644 --- a/urlwatch/docker-compose.yml +++ b/urlwatch/docker-compose.yml @@ -1,5 +1,7 @@ -urlwatch: - image: vimagick/urlwatch - volumes: - - ./data:/root/.urlwatch - restart: unless-stopped +services: + urlwatch: + image: vimagick/urlwatch + volumes: + - ./data:/root/.urlwatch + - ./data/crontab:/etc/crontabs/root + restart: unless-stopped \ No newline at end of file