From e8f131b973b2379237ca802bd543a6c0763b3fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Engl=C3=B6f=20Ytterstr=C3=B6m?= Date: Fri, 31 Jan 2025 12:13:28 +0100 Subject: [PATCH] Add crontab example --- README | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/README b/README index 5cfd9e1..4b87af6 100644 --- a/README +++ b/README @@ -24,6 +24,7 @@ for example by a cron job. than the provided datetime will be skipped. mkdir posts build media +podman build . podman run --rm -it \ -e TBS_CONSUMER_KEY= \ -e TBS_CONSUMER_SECRET= \ @@ -39,6 +40,43 @@ podman run --rm -it \ Mirror files are now available in `./build`, open `build/index.html` in a web browser to view it. +Typical Caddy config: + +``` +mirror.example.com { + root * /var/www/mirror.example.com + encode gzip + file_server +} +``` + +Typical crontab: + +``` +0 6 * * * $HOME/mirror.sh +``` + +mirror.sh: + +``` +#!/bin/bash +BLOG_NAME="your-blog-name" +yesterday=$(expr $(date -u +%s) - 86400) +podman run --rm -it \ +-e TBS_CONSUMER_KEY=$TBS_CONSUMER_KEY \ +-e TBS_CONSUMER_SECRET=$TBS_CONSUMER_SECRET \ +-e TBS_OAUTH_TOKEN=$TBS_OAUTH_TOKEN \ +-e TBS_OAUTH_SECRET=$TBS_OAUTH_SECRET \ +-e TBS_BLOG_NAME=$BLOG_NAME \ +-e TBS_LAST_SYNC=$yesterday \ +-v ./posts:/app/src/posts \ +-v ./build:/app/src/images \ +-v ./output:/app/site \ + +``` + + + Option 2: Make mirror and serve by httpd ----------------------------------------