bnosac / cronR

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

Bad minute error when using env argument #59

Closed sebsilas closed 1 year ago

sebsilas commented 1 year ago

When I try to feed my current environment variables to cron_add, as suggested by your documentation, like this:

library(cronR)
f   <- base::system.file("scripts/my_cron_job.R", package = "mypackage")
cmd <- cron_rscript(f)

cron_add(command = cmd,
         frequency = 'minutely',
         id = 'test1',
         description = 'Minute scrape',
         tags = c('lab', 'xyz'),
         env = Sys.getenv()) 

I get the following error:

"/var/folders/v6/8rv32yhn4cz0x_gnk0kvb8jr0000gn/T//RtmpA631WG/filea7f66a543048":32: bad minute crontab: errors in crontab file, can't install

Simply removing the env argument, everything works fine. But I need to feed my environment variables in. Did I misunderstand your documentation/is what I am trying to do possible?

jwijffels commented 1 year ago

Probably related to using spaces in your environment variables. Did you check what your crontab looks like when you pasw on argument dry_run?

sebsilas commented 1 year ago

You were correct. Thanks!