bnosac / cronR

A simple R package for managing your cron jobs.
Other
288 stars 38 forks source link

Error butcode proceeds #42

Closed sanjmeh closed 3 years ago

sanjmeh commented 3 years ago

Hi I get this every time: crontab: usage error: no arguments permitted after this option But the cronR::cron_add() goes ahead and adds successfully in the system crontab as I confirm by crontab -l

jwijffels commented 3 years ago

Can you provide a reproducible example?

sanjmeh commented 3 years ago

Here is a reprex: Please save a file with the following test code. Let's name it test.R

# test.R for testing cronR package
setwd("/home/rstudio/omni") # this can be changed to any path on your system
library(readr)
library(magrittr)
list.files(".") %>% write_lines("~/allfiles.txt") 

Then I create the command using this script:

cmd_reprex <- "/usr/lib/R/bin/Rscript '/home/rstudio/omni/test.R'  >> '/data/test.log' 2>&1"

Then I start the cron process by adding this into crontab by using the following cronR function.

cronR::cron_add(cmd_reprex,frequency = '*/5 * * * *',id = "reprex1",tags = "reprex_sm",description = "to demonstrate the crontab error",user = "rstudio")

Attaching screenshot of the error received on running the above command. Despite this error, the contab is updated in the Ubuntu 16.04 system file. So this is not a show stopper. But still wanted you to know. And perhaps this has an underlying problem that may trouble us later.

Screen Shot 2021-07-30 at 2 16 32 PM

jwijffels commented 3 years ago

Thanks for the bug report. The error is fixed in https://github.com/bnosac/cronR/commit/8c2e196f1f826bac39b7a1b70d8f1ea088a972ae