bnosac / taskscheduleR

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

cmd shows task run and then it gets immediately closed and nothing at output #58

Closed ashwininepa closed 6 years ago

ashwininepa commented 6 years ago

Hi,

I have scheduled one task which is weekly starting from today. When I create the task, it gets created and says:

Listening on http://127.0.0.1:3028 Creating task schedule: schtasks /Create /TN "CreatePPT.R" /TR "cmd /c C:/PROGRA~1/R/R-34~1.3/bin/Rscript.exe \"C:/Users/Ashwini.Visave/Documents/R/win-library/3.4/taskscheduleR/extdata/CreatePPT.R\" >> \"C:/Users/Ashwini.Visave/Documents/R/win-library/3.4/taskscheduleR/extdata/CreatePPT.log\" 2>&1" /SC ONCE /ST 13:53

There is no other task scheduled with the same name. When the time of schedule comes, command prompt quickly open and gets closes immediately. When I checked the log, it says that,

Information about package loading at start and then

Error: RStudio not running execution halted

Also, there is no space in the file path, as my file path is: C:\Users\Ashwini.Visave\CreatePPT

Can you please help in this?

jwijffels commented 6 years ago

Can you provide the CreatePPT.R file which you put at C:/Users/Ashwini.Visave/Documents/R/win-library/3.4/taskscheduleR/extdata/CreatePPT.R and the full log at C:/Users/Ashwini.Visave/Documents/R/win-library/3.4/taskscheduleR/extdata/CreatePPT.log

ashwininepa commented 6 years ago

Hi, here is the full log:

Loading required package: methods Warning message: package 'DBI' was built under R version 3.4.4 Loading required package: ggplot2 Loading required package: tidyverse -- Attaching packages --------------------------------------- tidyverse 1.2.1 -- v tibble 1.4.2 v purrr 0.2.5 v tidyr 0.8.1 v dplyr 0.7.6 v readr 1.1.1 v stringr 1.3.1 v tibble 1.4.2 v forcats 0.3.0 -- Conflicts ------------------------------------------ tidyverse_conflicts() -- x dplyr::filter() masks stats::filter() x dplyr::lag() masks stats::lag() Loading required package: lubridate

Attaching package: 'lubridate'

The following object is masked from 'package:base':

date

Loading required package: rvest Loading required package: xml2

Attaching package: 'rvest'

The following object is masked from 'package:purrr':

pluck

The following object is masked from 'package:readr':

guess_encoding

Loading required package: RCurl Loading required package: bitops

Attaching package: 'RCurl'

The following object is masked from 'package:tidyr':

complete

Welcome to the nepa R package version 0.3.18 (2018-08-29)! Work in progress - expect changes!

Attaching package: 'nepa'

The following object is masked from 'package:graphics':

pairs

There were 13 warnings (use warnings() to see them) Error: RStudio not running Execution halted Loading required package: methods Warning message: package 'DBI' was built under R version 3.4.4 Loading required package: ggplot2 Loading required package: tidyverse -- Attaching packages --------------------------------------- tidyverse 1.2.1 -- v tibble 1.4.2 v purrr 0.2.5 v tidyr 0.8.1 v dplyr 0.7.6 v readr 1.1.1 v stringr 1.3.1 v tibble 1.4.2 v forcats 0.3.0 -- Conflicts ------------------------------------------ tidyverse_conflicts() -- x dplyr::filter() masks stats::filter() x dplyr::lag() masks stats::lag() Loading required package: lubridate

Attaching package: 'lubridate'

The following object is masked from 'package:base':

date

Loading required package: rvest Loading required package: xml2

Attaching package: 'rvest'

The following object is masked from 'package:purrr':

pluck

The following object is masked from 'package:readr':

guess_encoding

Loading required package: RCurl Loading required package: bitops

Attaching package: 'RCurl'

The following object is masked from 'package:tidyr':

complete

Welcome to the nepa R package version 0.3.18 (2018-08-29)! Work in progress - expect changes!

Attaching package: 'nepa'

The following object is masked from 'package:graphics':

pairs

There were 13 warnings (use warnings() to see them) Error: RStudio not running Execution halted Loading required package: methods Warning message: package 'DBI' was built under R version 3.4.4 Loading required package: ggplot2 Loading required package: tidyverse -- Attaching packages --------------------------------------- tidyverse 1.2.1 -- v tibble 1.4.2 v purrr 0.2.5 v tidyr 0.8.1 v dplyr 0.7.6 v readr 1.1.1 v stringr 1.3.1 v tibble 1.4.2 v forcats 0.3.0 -- Conflicts ------------------------------------------ tidyverse_conflicts() -- x dplyr::filter() masks stats::filter() x dplyr::lag() masks stats::lag() Loading required package: lubridate

Attaching package: 'lubridate'

The following object is masked from 'package:base':

date

Loading required package: rvest Loading required package: xml2

Attaching package: 'rvest'

The following object is masked from 'package:purrr':

pluck

The following object is masked from 'package:readr':

guess_encoding

Loading required package: RCurl Loading required package: bitops

Attaching package: 'RCurl'

The following object is masked from 'package:tidyr':

complete

Welcome to the nepa R package version 0.3.18 (2018-08-29)! Work in progress - expect changes!

Attaching package: 'nepa'

The following object is masked from 'package:graphics':

pairs

There were 13 warnings (use warnings() to see them) Error: RStudio not running Execution halted Loading required package: methods Warning message: package 'DBI' was built under R version 3.4.4 Loading required package: ggplot2 Loading required package: tidyverse -- Attaching packages --------------------------------------- tidyverse 1.2.1 -- v tibble 1.4.2 v purrr 0.2.5 v tidyr 0.8.1 v dplyr 0.7.6 v readr 1.1.1 v stringr 1.3.1 v tibble 1.4.2 v forcats 0.3.0 -- Conflicts ------------------------------------------ tidyverse_conflicts() -- x dplyr::filter() masks stats::filter() x dplyr::lag() masks stats::lag() Loading required package: lubridate

Attaching package: 'lubridate'

The following object is masked from 'package:base':

date

Loading required package: rvest Loading required package: xml2

Attaching package: 'rvest'

The following object is masked from 'package:purrr':

pluck

The following object is masked from 'package:readr':

guess_encoding

Loading required package: RCurl Loading required package: bitops

Attaching package: 'RCurl'

The following object is masked from 'package:tidyr':

complete

Welcome to the nepa R package version 0.3.18 (2018-08-29)! Work in progress - expect changes!

Attaching package: 'nepa'

The following object is masked from 'package:graphics':

pairs

There were 13 warnings (use warnings() to see them) Error: RStudio not running Execution halted

And not sure if I can share the code here.

jwijffels commented 6 years ago

Looks like the schedule has run fine but somewhere in your code you apparently use r code which works only in interactive rstudio mode. You can see where your code fails by Adding options(echo=TRUE) in your script and you’ll need to solve your own code where it fails. The error is clearly unrelated to the taskscheduler r package.

ashwininepa commented 6 years ago

Hi, I am not using interactive mode in my code, while, I am connecting to database to extract the data then do the operations on data, then create the graphs and then push the graphs to PPT. Can it be related to connecting to database?

jwijffels commented 6 years ago

@ashwininepa without code, I can not help you further. As noted add options(echo=TRUE) in your script and you'll see where it fails and solve the issue you have with your code.

ashwininepa commented 6 years ago

Can I get your email id so that I can email you?