I think perhaps what you're reaching for is systemd timers. They can
run whatever command you like (including containers) and since you
already have the journald bits configured the logging part should "just
work".
See:
man systemd.timer
---
Chris Evich (he/him)
Senior Quality Assurance Engineer
If there's a "hard-way", I'm the first one to implement it.
On 8/6/24 09:39, jklaiho(a)iki.fi wrote:
I've got a bunch of Quadlet-based containers with
LogDriver=journald. This correctly captures the stdout/stderr of the main process of the
container, and the process output is then viewable using journalctl on the host side.
We now have a need to run cron jobs in one of our containers. We're running `podman
exec containername python /path/to/script.py` as the job on the host, but the stdout
prints from the script are not forwarded to the logging driver.
I see two choices:
1. Run the cron scripts as short-lived containers of their own, making them the main
process for the duration and presumably causing the journald driver to capture their
stdout as expected. IIRC there's a way for systemd to replace cron; what would be the
correct method of using Quadlet-based containers here? (We would create a separate quadlet
config per script.)
2. Somehow enable arbitrary script runs with `podman exec` against a running container to
interface with the journald driver. Is this possible to do?
_______________________________________________
Podman mailing list -- podman(a)lists.podman.io
To unsubscribe send an email to podman-leave(a)lists.podman.io