systemd-cron: Notes on "multiple trigger source candidates" warning/re-parsing the systemd state in cron-mail@

In testing I just got

2023-09-09T15:05:42+0200 tarta systemd[1]: cron-mail@cron-nabijaczleweli-nabijaczleweli-1.service:nometadata.service: multiple trigger source candidates for exit status propagation (cron-nabijaczleweli-nabijaczleweli-1.service, cron-nabijaczleweli-nabijaczleweli-1.service), skipping.

I had

OnSuccess=cron-mail@cron-nabijaczleweli-nabijaczleweli-1.service:nometadata.service
OnFailure=cron-mail@cron-nabijaczleweli-nabijaczleweli-1.service:nometadata.service

Adding

ExecStartPre=/bin/sh -c 'set | grep MONITOR_'

to cron-mail@ I got

2023-09-09T15:06:34+0200 tarta sh[819555]: MONITOR_EXIT_CODE='exited'
2023-09-09T15:06:34+0200 tarta sh[819555]: MONITOR_EXIT_STATUS='0'
2023-09-09T15:06:34+0200 tarta sh[819555]: MONITOR_INVOCATION_ID='fcce2cf2a657420e9913c533aebda51f'
2023-09-09T15:06:34+0200 tarta sh[819555]: MONITOR_SERVICE_RESULT='success'
2023-09-09T15:06:34+0200 tarta sh[819555]: MONITOR_UNIT='cron-nabijaczleweli-nabijaczleweli-1.service'

Notably, we already do

systemctl show --property=User --property=Environment --property=ActiveState --property=InvocationID "$unit"

but we could only reduce it to

systemctl show --property=User --property=Environment --property=ActiveState "$unit"

so this isn’t all that great, and we’d require a super-fresh systemd (12ba65964f1849a043db42871ccbcb522bc73575) and it’d complicate tests.

We should probably just generate

OnSuccess=cron-mail@cron-nabijaczleweli-nabijaczleweli-1.service:Success:nometadata.service
OnFailure=cron-mail@cron-nabijaczleweli-nabijaczleweli-1.service:Failure:nometadata.service

to silence the warning.

It appears impossible to silence the warning otherwise.

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 21 (21 by maintainers)

Commits related to this issue

Most upvoted comments

This could go in the NEWS file.

If check-dfsg-status maintainers want to configure their output specially, they can ship /lib/systemd/system/cron-monthly-check-dfsg-status.service.d/alwaysmail.conf that says

[Unit]
OnSuccess=
OnSuccess=cron-mail@%n:Success:nonempty:nometadata.service