Closed adamcagle closed 2 years ago
Thanks for the changes and the detailed description. Here some remarks:
No problem! I made those changes. Just let me know if there's anything else that's needed.
Thanks for the changes. Can you replace argument output_on_error = FALSE to
type = c("default", "output_on_error")
and
user type = match.arg(type)
inside the function and use argument type to do the logic,
that will still allow to add other types in the future while making the function call the same.
Like type = 'multiple' where you can pass multiple R scripts e.g.
You can also bump the version and add a news item, I'll merge then.
Will do! That actually gives me another idea. You might want some scripts to generate an output everytime they run so that you'd get an email regardless of whether or not there was an error. I'll add output_always
as a third option if you're on board with that.
I'm fine with other options regarding type
. Feel free to add pull requests. Would be good to have some unit tests of this of course.
I didn't check in detail the change you did here: https://github.com/bnosac/cronR/pull/52/files#diff-e9a0c9c4bebffe527085d3173fc97dc8c1ae0d27d0fd699a59583525f6926c27R23 but I presume that will be fine.
Thanks for merging! I'll work on some unit tests next.
Support Sending Email When And Only When Script Errors
cron_rscript()
so that stdout & stderr generate an output when and only when the R script errorsMAILTO
in crontabcron_rscript()
APIdeparse_crontab()
which always places cronR jobs at the bottom of the crontab (rather than at the beginning of the file as is the current convention) and places all non-cronR content at the top of the crontab. This preventsMAILTO
from being placed beneath the cronR jobs asMAILTO
must come before the cron job.MAILTO
email address unless the user chooses to manually edit the file. If they do that, the next timecron_rm()
is called, all theMAILTO
values will be moved to the top of the file and then the lastMAILTO
would superceed all prior values ; once again the user would need to manually edit the file.Other Changes
Bug Fix
cron_add()
andcron_rm()
in a crontab containing both cronR jobs and non-cronR jobs (or aMAILTO
line). Each time there is a round-trip betweencron_add()
andcron_rm()
a line sperating the cronR jobs and the non-cronR content is lost. This eventially causes a problem when all of the lines seperating the cronR and non-cronR content is removed ascron_rm()
will throw the error "new crontab file is missing newline before EOF, can't install."Warning Message
Encoding: UTF-8
to DESCRIPTION to address the warning generated by roxygen when runningroxygenise()
.