mobinmob / void-66-services

66 service frontends for voidlinux
Other
29 stars 11 forks source link

dcron: Lack of sendmail causes log spam #65

Closed flexibeast closed 3 years ago

flexibeast commented 3 years ago

My crontab runs certain commands every 5 minutes. However, sendmail is not present on the system, leading to the dcron service log mostly consisting of lines like:

2021-02-25 18:00:26.265563681  unable to exec /usr/sbin/sendmail: cron output for user alexis [command] to /dev/null

From reading the man page for dcrond(8), what i want is to use the -M option to dcrond so that no attempt to email is made (since the logging to stderr alone will suffice). Stopping the dcron service and running:

# dcrond -f -M /bin/true

from the command line results in no more errors like the above. (And to confirm, running the same command without -M /bin/true does result in those errors.)

However, changing the @execute line in the service file to:

66-ns -d 3 -o unshare=pid dcrond -f -M /bin/true

as a first step towards the -M option being configurable in an [environment] section, does not seem to have any effect: the above errors still appear in the service log even after restarting the dcron service with 66-enable -F. (And 66-inservice confirms that the above @execute line is active.)

Perhaps there's some namespacing issue here i'm not aware of (e.g. file descriptors)? Or is the issue something else entirely?

mobinmob commented 3 years ago

Thank you for the report! Do you have new "unable to exec" messages in the log after restarting the service? Can you provide me with a minimal crontab that exhibit the issue?

flexibeast commented 3 years ago

Do you have new "unable to exec" messages in the log after restarting the service?

Yes, sorry, i should have been clearer: the messages continue to fill the log even after restarting the service.

Can you provide me with a minimal crontab that exhibit the issue?

Sure:

*/1 * * * * echo "output"

This results in:

unable to exec /usr/sbin/sendmail: cron output for user test echo "output" to /dev/null
mobinmob commented 3 years ago

Thanks, I will check it in my system. Please try using /dev/null instead of executing /bin/true.

flexibeast commented 3 years ago

Using:

66-ns -d 3 -o unshare=pid dcrond -f -M /dev/null

continues to produce the "unable to exec" errors after restarting the service.

mobinmob commented 3 years ago

@flexibeast It seems to work here with: @execute = ( 66-ns -d 3 -o unshare=pid dcrond -d -M /usr/bin/true ) I used the -d switch in dcron to produce full debugging output, it also works with -f.

mobinmob commented 3 years ago

tail -f /var/log/66/dcron/current : https://termbin.com/fbvp 66-inservice dcron: https://termbin.com/ogd0

flexibeast commented 3 years ago

Gah. *sigh* It still doesn't work for me when i use the exact @execute line you posted. :-/ i certainly don't get debug output in the service log.

Just to confirm: you don't have sendmail in /usr/sbin/? i assume not, so i'm not sure what to do from here ....

mobinmob commented 3 years ago

I think I will try to adapt this: https://gist.github.com/x-yuri/ca46523a1c7a2a803c603bc426bb1b27 In order to have good output in the per-service logger.

mobinmob commented 3 years ago

@flexibeast The line in execute is just to stop the log spam... It will take more to direct the output of the commands in crontab to the logger.

flexibeast commented 3 years ago

Oh, well, at any rate, i'm still getting the "unable to exec" entries spamming the dcron service log. And also, i just checked whether it made any difference whether it was a user crontab (my personal crontab is the source of the spam in my case) or a root crontab. No: putting

*/1 * * * * echo "output"

in the root crontab also produces the "unable to exec" spam.

mobinmob commented 3 years ago

Ι tried to add an [environment] as the runit service has $OPTS and ended up with: https://termbin.com/njiw . The output from 66-inservice is: https://termbin.com/bpdl. I stopped the running dcron service with 66-disable -S dcron and enabled +started the new with 66-enable -S -F dcron.

mobinmob commented 3 years ago

Fix merged in 73b33ba924e60798a0e74aaf8bf267372626dd5e.