[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Q: systemd-timer vs cron



On Tue, 2022-03-15 at 09:48 +0100, Michael Biebl wrote:
> Am 15.03.22 um 03:31 schrieb Paul Wise:
> > On Mon, 2022-03-14 at 11:47 +0100, Marco d'Itri wrote:
> > 
> > > Yes, this is true. These are the unit and script that I use, and I think
> > > that Debian would benefit from having something like this available in
> > > some common package.
> > ...
> > > $(systemctl status "$FAILED_UNIT" --full --lines=100)
> > 
> > Unfortunately for my cron jobs I need the entire output of the command
> > invocation, don't want any output from prior runs of the command and
> > don't want any of the output to end up in the systemd journal.
> > 
> > So I need something like StandardOutput=mail or to add some sort of
> > wrapper script to each of the relevant systemd timers.
> 
> I might be mistaken here, but Luca hinted at
> $MONITOR_INVOCATION_ID in his email which means one could easily filter 
> journal output for the last failed invocation using this 
> $MONITOR_INVOCATION_ID.
> Luca, is this understanding correct?
> Afaics this would cover Paul's use case
> 
> Michael
> 
> [1] https://lists.debian.org/debian-devel/2022/03/msg00240.html

Yes indeed, logs can be filtered by invocation id, eg:

journalctl INVOCATION_ID=abcdefg

Also to make a unit's log "private" (not stored in the system journal)
LogNamespace= can be used, see:

https://www.freedesktop.org/software/systemd/man/systemd.exec.html#LogNamespace=

-- 
Kind regards,
Luca Boccassi

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: