An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090122/3a5f554f/attachment-0001.pl>
How to Run R Programs in a Scheduled Way
3 messages · Thorsten Muehge, Uwe Ligges, Tony
Thorsten Muehge wrote:
Hello R Experts, does anyone know how to run R programs automatically using the window scheduler? I want to run some R programs automatically and make the results available via web.
Write some Windows command script (also referred to as batch file) that calls Rterm with some input file or R CMD BATCH. Then tell your scheduler to run that file as you like. For me this worked very well with Windows XP and Windows Server 2003. In Windows Server 2008 64-bit (and hence I guess the same in Vista) I found that the new scheduler runs R extremely slow (by a factor of roughly 10 if some relevant amount of CPU performance and IO traffic is requested) so that I decided to moved to a cron implementation. At least, I have not found any solution for the Windows 2008 task scheduler so far. Uwe Ligges
Mit freundlichen Gr????en / Best Regards / ?? ???????????????????? ?????????????????????? / ??dv??zlettel Thorsten [[alternative HTML version deleted]] ------------------------------------------------------------------------
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Hi Thorsten, the way i do this (on Windows Vista Ultimate, SP1) is to create a batch file and then have windows task scheduler call it at a specific time. For example, to create my batch file i open up Notepad and type the following single line into it: "C:\Program Files\R\R-2.8.1\bin\R.exe" CMD BATCH --vanilla --slave "\ \PFO-SBS001\Redirected\tonyb\Desktop\myScript.R" so this is basically: "[location of R.exe]" CMD BATCH --vanilla -- slave "[location of your R script file]" I then save this Notepad text file, and change the extension from '.txt' to '.bat'. If you double click on this .bat file, it will run your script. All you have to do now is have scheduler point to your new .bat file :-) HTH, Tony Breyal P.S. Be careful with windows scheduler (at least in Vista) if you want the same script to run several times a day (e.g. setting a daily trigger starting at 0900 and repeating every 2 hours for a duration of 12 hours). Instead of stopping when expected, it will just keep going every 2 hours regardless of the duration you set (the only way around this that i found was to programme in time constraints into my r script itself, such as only running the script if a condition like 9<=current.hour & current.hour<=21 are met.)
On 22 Jan, 09:10, Thorsten Muehge <MUE... at de.ibm.com> wrote:
Hello R Experts, does anyone know how to run R programs automatically using the window scheduler? I want to run some R programs automatically and make the results available via web. Mit freundlichen Gr????en / Best Regards / ?? ???????????????????? ????????????????? ???? / ??dv??zlettel Thorsten ? ? ? ? [[alternative HTML version deleted]]
______________________________________________ R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.