Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

here incorrect working directory using cronr package #93

Open
HugoGit39 opened this issue May 24, 2023 · 1 comment
Open

here incorrect working directory using cronr package #93

HugoGit39 opened this issue May 24, 2023 · 1 comment

Comments

@HugoGit39
Copy link

HugoGit39 commented May 24, 2023

Hi

When you use here() it starts in the wrong working directory when a RECURRING cronjob is set using the cronr package. With a ONCE executed cronjob it does work somehow

Example:

My working dir is /home/rstudio/R/r-projects. I have set this in Global options. Moreover I have set in the .Rprofile this wd as starting dir for the cronjob. via CRON_LIVE

However when the cronjob starts here states:

here() starts at /home/rstudio

This is the old, initial wd

The solution is that I had to set the wd in the command line and than lib:

setwd("/home/rstudio/R/r-projects")
library(here)

However this shouldnt be the case officially. I dont know if this is an here or cronr issue btw. But a solution would be great!

@krlmlr
Copy link
Member

krlmlr commented May 25, 2023

I'm not familiar with the cronr package, but cronjobs have a very specific notion of the environment (working directory, environment variables, ...) they are executed in. The initial working directory of the R process is what drives the behavior of the here package.

@bnosac: Can you help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants