Document scheduled WCX updates

This commit is contained in:
2026-07-18 11:00:20 +02:00
parent 4bea8077ec
commit 35e973999f
2 changed files with 85 additions and 10 deletions

View File

@ -761,15 +761,37 @@ Google Cloud Vision does not guarantee this exact structure. Unexpected output i
OCR processing is currently started manually for one movie ID at a time. OCR processing is currently started manually for one movie ID at a time.
## Planned next steps ## Scheduled updates
Potential next steps include: WCX is updated automatically by a systemd timer.
The timer runs every night around 03:30. The wrapper script only performs a
full update when at least approximately 48 hours have passed since the previous
successful scheduled run.
Check the timer:
```bash
systemctl list-timers wcx-update.timer
```
Follow the service log:
```bash
sudo journalctl -u wcx-update.service -f
```
Show the latest service output:
```bash
sudo journalctl -u wcx-update.service -n 100 --no-pager
````
Run the scheduled service manually:
```bash
sudo systemctl start wcx-update.service
```
Check its status:
```bash
systemctl status wcx-update.service --no-pager
```
The timestamp of the latest successful scheduled update is stored in:
database/last_scheduled_update
* automatically process movies with `ocr_status = pending`
* add retry support for failed OCR requests
* provide commands for manually approving or correcting OCR results
* add database backup handling
* export the complete index to JSON or CSV
* add Emby-compatible metadata export
* schedule the scraper and import process
* create an orchestration script for the complete automated workflow

53
scripts/scheduled_update_wcx.sh Executable file
View File

@ -0,0 +1,53 @@
#!/usr/bin/env bash
#
# Run the WCX update at most once every 48 hours.
#
# The systemd timer invokes this script every night. The timestamp file is
# updated only after a successful WCX update.
#
set -Eeuo pipefail
ROOT_DIR="/storage/disk1/WCX"
UPDATE_SCRIPT="${ROOT_DIR}/scripts/update_wcx.sh"
STAMP_FILE="${ROOT_DIR}/database/last_scheduled_update"
MINIMUM_INTERVAL_SECONDS=$((47 * 60 * 60))
log() {
printf '[%s] %s\n' \
"$(date '+%Y-%m-%d %H:%M:%S')" \
"$*"
}
if [[ ! -x "${UPDATE_SCRIPT}" ]]; then
log "ERROR: Update script is missing or not executable: ${UPDATE_SCRIPT}" >&2
exit 1
fi
if [[ -f "${STAMP_FILE}" ]]; then
current_time=$(date +%s)
previous_time=$(stat -c %Y "${STAMP_FILE}")
elapsed_seconds=$((current_time - previous_time))
if (( elapsed_seconds < MINIMUM_INTERVAL_SECONDS )); then
elapsed_hours=$((elapsed_seconds / 3600))
log "Skipping update; previous successful scheduled run was ${elapsed_hours} hours ago."
exit 0
fi
fi
log "Starting scheduled WCX update."
"${UPDATE_SCRIPT}"
touch "${STAMP_FILE}"
log "Scheduled WCX update completed successfully."