Adding an option for a trailing argument to cron_rscript.R #32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Services to monitor cron jobs, like Healthchecks.io, require adding an command to the cron job command. For example,
cd '/home/rstudio/Documents/scripts/neon4cast-scoring' && /usr/local/lib/R/bin/Rscript '/home/rstudio/Documents/scripts/neon4cast-scoring/scoring.R' > '/efi_neon_challenge/log/cron/scoring.log' 2>&1 && curl -fsS -m 10 --retry 5 -o /dev/null https://hc-ping.com/1dd67f13-3a08-4a2b-86a3-6f13cb36baca
has the
curl -fsS -m 10 --retry 5 -o /dev/null https://hc-ping.com/1dd67f13-3a08-4a2b-86a3-6f13cb36baca
at the end of the command. Currently,cron_rscript.R
does not support adding a command like this after part of the command that sends the R output to the log.To support this, I added an optional argument to cron_script.R called
trailing_arg
that will add the string to the end of the command - always after the log assignment.if(!is.null(trailing_arg)){ cmd <- sprintf("%s %s %s", cmd, "&&", trailing_arg) }