3.7 KiB
type, title, description, tags, timestamp
| type | title | description | tags | timestamp | |||
|---|---|---|---|---|---|---|---|
| operations | Cron Lifecycle | How entrypoint.sh validates env, renders /etc/cron.d/tenbackward from RUN_AT/TZ, and hands off to cron -f. |
|
2026-08-04T17:51:00Z |
Purpose
entrypoint.sh is the first process inside the container. Its job is
to refuse to boot when something is wrong with env config and to
materialise a cron file from the templated values.
Sequence
-
Set
DEBIAN_FRONTEND=noninteractive. -
Set
TZ(defaultEurope/Berlin) and link/etc/localtimeif/usr/share/zoneinfo/${TZ}exists and/etc/localtimedoes not. -
Iterate over
required_vars. Any empty variable aborts withERROR: missing required environment variable(s): ...and exits1. The current required set is listed in Environment Variable Setup. -
Validate
RUN_ATagainst^([01][0-9]|2[0-3]):[0-5][0-9]$. Invalid input exits1withERROR: RUN_AT='X' must be in HH:MM (24-hour) format. -
Render
/etc/cron.d/tenbackwardinto amktempfile with:SHELL=/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin TZ=${TZ} ${minute} ${hour} * * * cd /app && /usr/local/bin/python -m tenbackward >> /app/data/cron.log 2>&1 -
Install the rendered file with mode
0644, root:root. -
Run
crontab/install-cron.sh /etc/cron.d/tenbackward. The helper refuses files that still contain the__RUN_AT__placeholder and files that do not start with an^[A-Z_]+=cron env line. -
Print a one-line confirmation:
tenbackward: starting cron (RUN_AT=..., TZ=...). -
exec cron -f.
Output Files
| Path | Owner / Mode | Purpose |
|---|---|---|
/etc/cron.d/tenbackward |
root / 0644 | The rendered cron file. |
/app/data/cron.log |
container user / append | python -m tenbackward stdout+stderr. |
/app/data/posted.json |
container user / rw | Persisted state from tenbackward.state. |
Cron Helpers
| File | Purpose |
|---|---|
crontab/tenbackward.cron |
Static template (env + PATH) shipped in the image. |
crontab/install-cron.sh |
Validates and installs a rendered cron file with mode 0644. |
Operator Recipes
-
Trigger a manual run without waiting for the cron tick:
docker compose exec tenbackward /usr/local/bin/python -m tenbackward -
Inspect the rendered cron file (the file the container actually installed):
docker compose exec tenbackward cat /etc/cron.d/tenbackward -
Tail the structured logs produced by the bot:
docker compose exec tenbackward tail -n 100 /app/data/cron.logExpect one JSON object per line (
startup, optionalrun_complete, orpipeline_error/pipeline_failed).
Build Script Notes
build.sh now cds into its own script directory (so it works
no matter where it is invoked from) and, when possible, symlinks
itself to /usr/local/bin/build.sh so the build can also be run as a
plain build.sh command inside the build context. The symlink is a
best-effort || true, so a read-only filesystem will not break the
build.