bnosac / cronR

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

Support setting environment variable for cron jobs #47

Closed atusy closed 2 years ago

atusy commented 2 years ago

To enable something like below This is especially important for non-ASCII users to set LANG for example.

cronR::cron_add(
  command = 'echo "$FOO" >> /home/atusy/cronR.log',
  frequency = 'minutely',
  id = 'test1',
  description = 'My procest 1',
  tags = c('lab', 'xyz'),
  ask=FALSE,
  env=c(FOO="BAR")
)
Adding cronjob:
---------------

## cronR job
## id:   test1
## tags: lab, xyz
## desc: My procest 1
FOO=BAR
0-59 * * * * echo "$FOO" >> /home/atusy/cronR.log
jwijffels commented 2 years ago

Thanks, looks great. Can you only replace the call to paste0 to a call to paste + add an item in the inst/NEWS file. Thanks

atusy commented 2 years ago

@jwijffels Thanks for the comment! Done!

jwijffels commented 2 years ago

thanks for the contribution

atusy commented 2 years ago

Great! Thank you too!! I recently published a book in Japanese and introduced this nice package!! And I had a response from a reader about this feature : )

jwijffels commented 2 years ago

That's nice to hear. FYI. I'll publish to cran in one of the coming days.

jwijffels commented 2 years ago

the updated package (0.6.1) is now on cran https://cran.r-project.org/web/packages/cronR/index.html

atusy commented 2 years ago

Cool!!! Thank you so much!!!