Running Unattended - ZornTaov/ZornCoMix GitHub Wiki

Running Unattended

update_comics.py resumes every comic in a library, once or daily, steered by two files on the share.

python update_comics.py "D:/Comics" --dry-run                # what would run, and with what arguments
python update_comics.py "D:/Comics"                          # run once
python update_comics.py "D:/Comics" --schedule 03:30 --jobs 2
python update_comics.py "D:/Comics" --schedule 03:30 --now   # and once immediately
Flag Effect
--schedule HH:MM Stay running and update daily at this local time; without it, run once and exit.
--now Update straight away, then follow the schedule; on a container, proves a fresh start works.
-j, --jobs N Comics at once, each with its own browser. Default 1.
-t, --timeout SECONDS Kill a hung comic and its browser process tree. Default 1800.
-o, --only NAME Only this comic; repeatable, takes the wildcards below.
-n, --dry-run List what would run and each comic's command.
--max-depth N How deep to look for comics. Default 5.
--progress SECONDS How often to report comics still going. Default 60; 0 is off.
--web PORT, --web-host ADDRESS Serve The Web Page (all interfaces by default; 127.0.0.1 for local only).
--no-pack-chapters, --no-refresh-chapters See Keeping chapters current.
--config FOLDER The settings folder; see Settings and Metadata.

--schedule prints the clock and time zone it believes it is in; check it, since a wrong zone fires updates hours off.

What a run does

Each comic runs as its own process, so one bad site cannot take the run down; ended comics are skipped; results are logged as each finishes. Nothing new is a check, not an update: it prints No new pages: this comic is up to date and records nothing, so the archive's metadata is not rewritten daily and summed pages_saved stays a fair count. After a failed run, one clean run is recorded as news it works again.

Starting an update without waiting

A waiting --schedule checks the library root every 30 seconds for update-now (or update-now.txt), deletes it, and starts an update. Empty means everything; otherwise list comic folders:

# lines starting with # are ignored
Uncompressed/SomeAuthor/TheirComic
MyComic
Uncompressed/SomeAuthor/*

* reaches into subfolders at any depth; the same patterns work with --only. Anything that can write to the share can start a run, with no SSH. To add a batch: prime them on your own machine, drop an update-now.txt naming them, and watch the container log.

Restarting without reaching the container

A restart (or restart.txt) file in the library root, checked every 30 seconds and at start, makes the updater wait for the running job and those queued behind it, then exit; with restart: unless-stopped (or always) the container comes back reading every script afresh, and without it just stops. Jobs queued later are forgotten, so queue them again. The file is removed before exiting so it restarts once; if it cannot be, that is logged and nothing restarts. Delete it while waiting to call the restart off. An update-now dropped alongside waits for the next updater.

Exit codes

Code Meaning
0 finished normally
1 interrupted
2 bad arguments
3 no image found; on a comic that used to work, the site changed and needs a new element path
4 a download failed after retries
5 the browser or driver would not start
6 a page never finished loading; usually transient, retry
7 something unexpected, printed with the error
8 the next link runs backwards through pages already held (details)
9 the site reuses image names between chapters; turn prefix on
10 the next link skips pages the index lists, and no other path reaches the right one (details)
11 the same picture was found as the comic on 5 pages in a row: a menu or banner every page shows, not the comic. The message names the path that found it and the pages already saved as it (details)
12 a plugin's program failed; the last line gives its own exit code, and anything it fetched first is kept
13 a plugin's program ran out of time and was stopped; what it fetched is kept, and the next run carries on