bnosac / taskscheduleR

Schedule R scripts/processes with the Windows task scheduler.
330 stars 72 forks source link

Minimized cmd.EXE #52

Closed Guceri closed 6 years ago

Guceri commented 6 years ago

Is there a way to default the cmd window to stay minimized while the process runs? I have a script that takes some time and is run often and the pop up is frequent. Is this something that is possible within the package?

jwijffels commented 6 years ago

Same question as #32

Guceri commented 6 years ago

Thank you. That answered the question and seems to have worked. I do seem to be running into a new road block in which the packages on the script that is scheduled to run do not load. There is an error message saying the package can not be found. I have tried reinstalling all the packages (and even their dependencies) using an admin instance of Rstudio.

When taskscheduler is not run as admin, the script fires on schedule normally (but obviously the cmd window keeps popping up). I think there is one more step here that I am missing to link the packages so they are seen. Any suggestions?

On Tue, Aug 14, 2018 at 5:05 PM jwijffels notifications@github.com wrote:

Same question as #32 https://github.com/bnosac/taskscheduleR/issues/32

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bnosac/taskscheduleR/issues/52#issuecomment-413016003, or mute the thread https://github.com/notifications/unsubscribe-auth/AdsxYEUlF-NO1evWwP-jaKG-7emyHmTMks5uQzu0gaJpZM4V9I_5 .

Guceri commented 6 years ago

I was able to solve it using .libPaths() I was able to find that there were two library paths. I just copied the packages from one to the other and that seems to solve the problem. I don't quite understand though why the package directory is changed when using "SYSTEM" as your log in with taskscheduler.

On Wed, Aug 15, 2018 at 12:44 AM Tolga Guceri guceri@gmail.com wrote:

Thank you. That answered the question and seems to have worked. I do seem to be running into a new road block in which the packages on the script that is scheduled to run do not load. There is an error message saying the package can not be found. I have tried reinstalling all the packages (and even their dependencies) using an admin instance of Rstudio.

When taskscheduler is not run as admin, the script fires on schedule normally (but obviously the cmd window keeps popping up). I think there is one more step here that I am missing to link the packages so they are seen. Any suggestions?

On Tue, Aug 14, 2018 at 5:05 PM jwijffels notifications@github.com wrote:

Same question as #32 https://github.com/bnosac/taskscheduleR/issues/32

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bnosac/taskscheduleR/issues/52#issuecomment-413016003, or mute the thread https://github.com/notifications/unsubscribe-auth/AdsxYEUlF-NO1evWwP-jaKG-7emyHmTMks5uQzu0gaJpZM4V9I_5 .

jwijffels commented 6 years ago

Because you now run your R script as the system user instead of your own user. The system user does not have the library folder of your user available. The example R script in the package (https://github.com/bnosac/taskscheduleR/blob/master/inst/extdata/helloworld.R) which is used in all the examples given in the R package shows the libPaths and also shows the environment variables which will also be different of course than if you run it as your user instead of the system user. Either way, I think you found a reasonable solution to your problem. Closing.