Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added os.manage, os.shutdown, os.restart, os.hibernate, os.sleep, os.…

…lock

These are a set of functions to turn off the computer after simulation or the likes.

Also removed "shutdown".
  • Loading branch information...
commit 3c41ca1dd0bb38cd8c0c8dd9c67bab6a2df35fce 1 parent 775b201
@talgalili authored
View
3  DESCRIPTION
@@ -3,7 +3,7 @@ Type: Package
Title: Functions for updating and installing a new version of R and other
software - from R
Version: 0.8.6
-Date: 2013-03-12
+Date: 2013-03-13
Author: Tal Galili
Maintainer: Tal Galili <tal.galili@gmail.com>
Description: The 'installr' package aims at making the process of updating R on
@@ -26,4 +26,5 @@ Collate:
'create.global.library.r'
'install.r'
'updateR.r'
+ 'os.manage.r'
'zzz.r'
View
7 NAMESPACE
@@ -20,6 +20,11 @@ export(installr)
export(is.Rgui)
export(is.RStudio)
export(is.windows)
-export(shutdown)
+export(os.hibernate)
+export(os.lock)
+export(os.manage)
+export(os.restart)
+export(os.shutdown)
+export(os.sleep)
export(source.https)
export(updateR)
View
21 NEWS
@@ -2,15 +2,26 @@ installR 0.8.6
--------------
NEW FUNCTIONS ADDED:
+ * install.ImageMagick
+ * install.GraphicsMagick
+ * install.LyX
+ * os.manage, os.shutdown, os.restart, os.hibernate, os.sleep, os.lock (set of functions to turn off the computer after simulation or the likes)
+
+UPDATED FUNCTIONS:
+ * install.Rtools - removed "latest_Frozen", added "check". Made the function know which Rtools to install based on your R version (and if it is not known - it asks the user to choose a version)
+ * Removed shutdown (turned into os.shutdown)
+
+
+installR 0.8.5
+--------------
+
+NEW FUNCTIONS ADDED:
* installr - allows the user to choose which software to install (from a GUI or console based menu system)
* A new GUI for Rgui - added the "Update" to the menu, with three submenu items: Update R, Update R Packages, and Installing software. (thanks to Dason and Yihui Xie for their ideas and help)
* shutdown - Shut down the operating system with the command `shutdown'. A modified version of Yihui's shitdown function from the {fun} package (see: https://github.com/yihui/fun/blob/master/R/shutdown.R)
* is.RStudio - checks if the current R session is running within RStudio or not.
* is.Rgui - checks if the current R session is running within Rgui or not.
* add.installr.GUI and remove.installr.GUI - for adding a menu system to Rgui
- * install.ImageMagick
- * install.GraphicsMagick
- * install.LyX
UPDATED FUNCTIONS:
* install.URL -
@@ -25,7 +36,6 @@ UPDATED FUNCTIONS:
* now checks if R was installed or not (Based on the output of install.R), and removed the need to ask the user that.
* ask.user.yn.question - added a menu based GUI.
* check.for.updates.R - added a menu based GUI.
- * install.Rtools - removed "latest_Frozen", added "check". Made the function know which Rtools to install based on your R version (and if it is not known - it asks the user to choose a version)
BUG FIXES:
* Fixed a bug in updateR, to make sure it will be able to open the new Rgui, and also close the old R.
@@ -134,4 +144,5 @@ TODO for future releases:
* Better integration with the "global library" strategy
* update RTools to be smarter about how to ask the user what to choose. Also check if the Rtools is already installed or not (devtools has such a function)
* update README.md for 0.8.5
-
+ * Add install.notepad and install.notepadpp
+ * Maybe add some timer to the os.manage functions. And also allow input for how long from x time to perform the action.
View
36 R/install.r
@@ -694,42 +694,6 @@ source.https <- function(URL,..., remove_r_file = T) {
-#' @title Shut down the operating system with the command `shutdown'
-#' @export
-#' @description
-#' There is a command \command{shutdown} in both Windows and Linux,
-#' and this function uses it to shut down a computer.
-#'
-#' After the time \code{wait} has passed, R will execute \command{shutdown -s -t 0} (for Windows) or \command{shutdown -h now} to shut down the computer.
-#'
-#' This function is a modified version of Yihui's shutdown function from the {fun} package.
-#' @param s time to wait before shutting down (in seconds), added to m and h; passed to \code{\link[base]{Sys.sleep}}
-#' @param m time to wait before shutting down (in minutes), added to s and h; passed to \code{\link[base]{Sys.sleep}}
-#' @param h time to wait before shutting down (in hours), added to s and m; passed to \code{\link[base]{Sys.sleep}}
-#' @return The status code of \code{\link[base]{system}}.
-#' @author Yihui Xie <\url{http://yihui.name}>, and Tal Galili
-#' @seealso \code{\link[base]{system}},\code{\link[base]{shell}}, \code{\link[base]{Sys.sleep}}, \code{\link{is.windows}}
-#' @references \url{http://cos.name/en/topic/shut-down-your-windows-with-r} , \url{https://github.com/yihui/fun/blob/master/R/shutdown.R}
-#' @examples
-#' \dontrun{
-#' ## when your code is extremely time-consuming, you may need this function; e.g. you go to sleep, and R is running long computation... complex graphics... and long long computation... at last,
-#' shutdown()
-#' ## the next day you wake up, "thank you, R" :)
-#' }
-shutdown = function(s=0, m=0, h=0) {
-
- wait <- s + m*60 + h*60*60
- Sys.sleep(wait)
-
- ifelse(is.windows(),
- shell("shutdown -s -t 0", wait = F),# without wait =F, the shuting down will not work properly since Windows will wait for R to close (which will be waiting for Windows to shutdown)
- system("shutdown -h now"))
-}
-
-
-
-
-
#' @title Installing software from R
#' @export
#' @description Gives the user the option to download software from within R.
View
208 R/os.manage.r
@@ -0,0 +1,208 @@
+
+#' @title Shut down the operating system with the command `shutdown'
+#' @export
+#' @description
+#' There is a command \command{shutdown} in both Windows and Linux,
+#' and this function uses it to shut down a computer.
+#'
+#' After the time \code{wait} has passed, R will execute \command{shutdown -s -t 0} (for Windows) or \command{shutdown -h now} to shut down the computer.
+#'
+#' This function is a modified version of Yihui's shutdown function from the {fun} package.
+#' @param s time to wait before shutting down (in seconds), added to m and h; passed to \code{\link[base]{Sys.sleep}}
+#' @param m time to wait before shutting down (in minutes), added to s and h; passed to \code{\link[base]{Sys.sleep}}
+#' @param h time to wait before shutting down (in hours), added to s and m; passed to \code{\link[base]{Sys.sleep}}
+#' @return The status code of \code{\link[base]{system}}.
+#' @author Yihui Xie <\url{http://yihui.name}>, and Tal Galili
+#' @seealso \code{\link[base]{system}},\code{\link[base]{shell}}, \code{\link[base]{Sys.sleep}},
+#' \code{\link{is.windows}}, \code{\link{os.shutdown}}, \code{\link{os.sleep}}, \code{\link{os.hibernate}}, \code{\link{os.lock}}, \code{\link{os.restart}}
+#' @references \url{http://cos.name/en/topic/shut-down-your-windows-with-r} , \url{https://github.com/yihui/fun/blob/master/R/shutdown.R}
+#' @examples
+#' \dontrun{
+#' ## when your code is extremely time-consuming, you may need this function; e.g. you go to sleep, and R is running long computation... complex graphics... and long long computation... at last,
+#' os.shutdown()
+#' ## the next day you wake up, "thank you, R" :)
+#' }
+os.shutdown <- function(s=0, m=0, h=0) {
+
+ wait <- s + m*60 + h*60*60
+ Sys.sleep(wait)
+
+ ifelse(is.windows(),
+ shell("shutdown -s -t 0", wait = F),# without wait =F, the shuting down will not work properly since Windows will wait for R to close (which will be waiting for Windows to shutdown)
+ system("shutdown -h now"))
+}
+
+
+
+
+
+
+
+#' @title Sleeps the operating system (Windows) through a shell command
+#' @export
+#' @description
+#' This sleeps Windows after set amount of time.
+#' @param s time to wait before shutting down (in seconds), added to m and h; passed to \code{\link[base]{Sys.sleep}}
+#' @param m time to wait before shutting down (in minutes), added to s and h; passed to \code{\link[base]{Sys.sleep}}
+#' @param h time to wait before shutting down (in hours), added to s and m; passed to \code{\link[base]{Sys.sleep}}
+#' @param first_turn_hibernate_off The command rundll32.exe powrprof.dll,SetSuspendState 0,1,0 for sleep is correct - however, it will hibernate instead of sleep if you don't turn the hibernation off. I'm not sure this is true, but that's what is explained in the linke (see bellow)
+#' @return The status code of \code{\link[base]{shell}}.
+#' @author Tal Galili
+#' @seealso \code{\link[base]{system}},\code{\link[base]{shell}}, \code{\link[base]{Sys.sleep}},
+#' \code{\link{is.windows}}, \code{\link{os.shutdown}}, \code{\link{os.sleep}}, \code{\link{os.hibernate}}, \code{\link{os.lock}}, \code{\link{os.restart}}
+#' @references
+#' \url{http://superuser.com/questions/42124/how-can-i-put-the-computer-to-sleep-from-command-prompt-run-menu} , \url{http://www.howtogeek.com/howto/windows-vista/quick-tip-create-shutdown-restart-lock-icons-in-windows-vista/}, \url{http://superuser.com/a/135450/28536}
+#' @examples
+#' \dontrun{
+#' ## when your code is extremely time-consuming, you may need this function to run at the end of the simulation.
+#' os.sleep()
+#' }
+os.sleep <- function(s=0, m=0, h=0, first_turn_hibernate_off = TRUE) {
+
+ wait <- s + m*60 + h*60*60
+ Sys.sleep(wait)
+
+ if(first_turn_hibernate_off & is.windows()) {
+ shell("powercfg -hibernate off", wait = F) # without wait =F, the shuting down will not work properly since Windows will wait for R to close (which will be waiting for Windows to shutdown)
+ }
+
+
+ ifelse(is.windows(),
+ shell("rundll32.exe powrprof.dll,SetSuspendState 0,1,0", wait = F),# without wait =F, the shuting down will not work properly since Windows will wait for R to close (which will be waiting for Windows to shutdown)
+ warning("This function doesn't handle non-Windows OS (you are welcome to contribute code to let me know how to do it, e-mail: tal.galili@gmail.com)."))
+}
+
+
+
+#' @title Hibernate the operating system (Windows) through a shell command
+#' @export
+#' @description
+#' This Hibernates Windows after set amount of time.
+#' @param s time to wait before shutting down (in seconds), added to m and h; passed to \code{\link[base]{Sys.sleep}}
+#' @param m time to wait before shutting down (in minutes), added to s and h; passed to \code{\link[base]{Sys.sleep}}
+#' @param h time to wait before shutting down (in hours), added to s and m; passed to \code{\link[base]{Sys.sleep}}
+#' @param first_turn_hibernate_on
+#' @return The status code of \code{\link[base]{shell}}.
+#' @author Tal Galili
+#' @seealso \code{\link[base]{system}},\code{\link[base]{shell}}, \code{\link[base]{Sys.sleep}},
+#' \code{\link{is.windows}}, \code{\link{os.shutdown}}, \code{\link{os.sleep}}, \code{\link{os.hibernate}}, \code{\link{os.lock}}, \code{\link{os.restart}}
+#' @references \url{http://superuser.com/questions/42124/how-can-i-put-the-computer-to-sleep-from-command-prompt-run-menu} , \url{http://www.howtogeek.com/howto/windows-vista/quick-tip-create-shutdown-restart-lock-icons-in-windows-vista/}
+#' @examples
+#' \dontrun{
+#' ## when your code is extremely time-consuming, you may need this function to run at the end of the simulation.
+#' os.hibernate()
+#' }
+os.hibernate <- function(s=0, m=0, h=0, first_turn_hibernate_on = TRUE) {
+
+ wait <- s + m*60 + h*60*60
+ Sys.sleep(wait)
+
+ if(first_turn_hibernate_on & is.windows()) {
+ shell("powercfg -hibernate on", wait = F) # without wait =F, the shuting down will not work properly since Windows will wait for R to close (which will be waiting for Windows to shutdown)
+ }
+
+ ifelse(is.windows(),
+ shell("rundll32.exe powrprof.dll,SetSuspendState Hibernate", wait = F),# without wait =F, the shuting down will not work properly since Windows will wait for R to close (which will be waiting for Windows to shutdown)
+ warning("This function doesn't handle non-Windows OS (you are welcome to contribute code to let me know how to do it, e-mail: tal.galili@gmail.com)."))
+}
+
+
+
+
+#' @title Locks the operating system (Windows) through a shell command
+#' @export
+#' @description
+#' This locks Windows after set amount of time.
+#' @param s time to wait before shutting down (in seconds), added to m and h; passed to \code{\link[base]{Sys.sleep}}
+#' @param m time to wait before shutting down (in minutes), added to s and h; passed to \code{\link[base]{Sys.sleep}}
+#' @param h time to wait before shutting down (in hours), added to s and m; passed to \code{\link[base]{Sys.sleep}}
+#' @return The status code of \code{\link[base]{shell}}.
+#' @author Tal Galili
+#' @seealso \code{\link[base]{system}},\code{\link[base]{shell}}, \code{\link[base]{Sys.sleep}},
+#' \code{\link{is.windows}}, \code{\link{os.shutdown}}, \code{\link{os.sleep}}, \code{\link{os.hibernate}}, \code{\link{os.lock}}, \code{\link{os.restart}}
+#' @references \url{http://superuser.com/questions/42124/how-can-i-put-the-computer-to-sleep-from-command-prompt-run-menu} , \url{http://www.howtogeek.com/howto/windows-vista/quick-tip-create-shutdown-restart-lock-icons-in-windows-vista/}
+#' @examples
+#' \dontrun{
+#' ## when your code is extremely time-consuming, you may need this function to run at the end of the simulation.
+#' os.lock()
+#' }
+os.lock <- function(s=0, m=0, h=0) {
+
+ wait <- s + m*60 + h*60*60
+ Sys.sleep(wait)
+
+ ifelse(is.windows(),
+ shell("Rundll32.exe User32.dll,LockWorkStation", wait = F),# without wait =F, the shuting down will not work properly since Windows will wait for R to close (which will be waiting for Windows to shutdown)
+ warning("This function doesn't handle non-Windows OS (you are welcome to contribute code to let me know how to do it, e-mail: tal.galili@gmail.com)."))
+}
+
+
+
+
+#' @title Restarts the operating system (Windows) through a shell command
+#' @export
+#' @description
+#' This restarts Windows after set amount of time.
+#' @param s time to wait before shutting down (in seconds), added to m and h; passed to \code{\link[base]{Sys.sleep}}
+#' @param m time to wait before shutting down (in minutes), added to s and h; passed to \code{\link[base]{Sys.sleep}}
+#' @param h time to wait before shutting down (in hours), added to s and m; passed to \code{\link[base]{Sys.sleep}}
+#' @return The status code of \code{\link[base]{shell}}.
+#' @author Tal Galili
+#' @seealso \code{\link[base]{system}},\code{\link[base]{shell}}, \code{\link[base]{Sys.sleep}},
+#' \code{\link{is.windows}}, \code{\link{os.shutdown}}, \code{\link{os.sleep}}, \code{\link{os.hibernate}}, \code{\link{os.lock}}, \code{\link{os.restart}}
+#' @references \url{http://superuser.com/questions/42124/how-can-i-put-the-computer-to-sleep-from-command-prompt-run-menu} , \url{http://www.howtogeek.com/howto/windows-vista/quick-tip-create-shutdown-restart-lock-icons-in-windows-vista/}
+#' @examples
+#' \dontrun{
+#' os.restart()
+#' }
+os.restart <- function(s=0, m=0, h=0) {
+
+ wait <- s + m*60 + h*60*60
+ Sys.sleep(wait)
+
+ ifelse(is.windows(),
+ shell("Shutdown.exe -r -t 00", wait = F),# without wait =F, the shuting down will not work properly since Windows will wait for R to close (which will be waiting for Windows to shutdown)
+ warning("This function doesn't handle non-Windows OS (you are welcome to contribute code to let me know how to do it, e-mail: tal.galili@gmail.com)."))
+}
+
+
+
+
+
+#' @title Gives managing option to the current OS (shutdown, restart, sleep, hibernate, etc...)
+#' @export
+#' @description
+#' A centeral function to run functions for shuting down, restarting, sleeping (etc.) your computer.
+#' This will run these functions immediatly.
+#' @param use_GUI a logical indicating whether a graphics menu should be used if available. If TRUE, and on Windows, it will use \link{winDialog}, otherwise it will use \link[utils]{menu}.
+#' @param ... not in use
+#' @return The status code of \code{\link[base]{system}}.
+#' @seealso \code{\link[base]{system}},\code{\link[base]{shell}}, \code{\link[base]{Sys.sleep}},
+#' \code{\link{is.windows}}, \code{\link{os.shutdown}}, \code{\link{os.sleep}}, \code{\link{os.hibernate}}, \code{\link{os.lock}}, \code{\link{os.restart}}
+#' @references \url{http://superuser.com/questions/42124/how-can-i-put-the-computer-to-sleep-from-command-prompt-run-menu} , \url{http://www.howtogeek.com/howto/windows-vista/quick-tip-create-shutdown-restart-lock-icons-in-windows-vista/}
+#' \url{http://cos.name/en/topic/shut-down-your-windows-with-r}
+#' @examples
+#' \dontrun{
+#' ## when your code is extremely time-consuming, you may need this function; e.g. you go to sleep, and R is running long computation... complex graphics... and long long computation... at last,
+#' os.manage()
+#' ## the next day you wake up, "thank you, R" :)
+#' }
+os.manage <- function(use_GUI = TRUE, ...) {
+ choices <- c("Shutdown",
+ "Sleep",
+ "Hibernate",
+ "Lock",
+ "Restart",
+ "Cancel")
+
+ the_answer <- menu(choices, graphics = use_GUI, title = "Managing action for your OS (for Windows)")
+
+ switch(the_answer,
+ os.shutdown(),
+ os.sleep(),
+ os.hibernate(),
+ os.lock(),
+ os.restart(),
+ return(FALSE)
+ )
+}
View
50 man/os.hibernate.Rd
@@ -0,0 +1,50 @@
+\name{os.hibernate}
+\alias{os.hibernate}
+\title{Hibernate the operating system (Windows) through a shell command}
+\usage{
+ os.hibernate(s = 0, m = 0, h = 0,
+ first_turn_hibernate_on = TRUE)
+}
+\arguments{
+ \item{s}{time to wait before shutting down (in seconds),
+ added to m and h; passed to
+ \code{\link[base]{Sys.sleep}}}
+
+ \item{m}{time to wait before shutting down (in minutes),
+ added to s and h; passed to
+ \code{\link[base]{Sys.sleep}}}
+
+ \item{h}{time to wait before shutting down (in hours),
+ added to s and m; passed to
+ \code{\link[base]{Sys.sleep}}}
+
+ \item{first_turn_hibernate_on}{}
+}
+\value{
+ The status code of \code{\link[base]{shell}}.
+}
+\description{
+ This Hibernates Windows after set amount of time.
+}
+\examples{
+\dontrun{
+## when your code is extremely time-consuming, you may need this function to run at the end of the simulation.
+os.hibernate()
+}
+}
+\author{
+ Tal Galili
+}
+\references{
+ \url{http://superuser.com/questions/42124/how-can-i-put-the-computer-to-sleep-from-command-prompt-run-menu}
+ ,
+ \url{http://www.howtogeek.com/howto/windows-vista/quick-tip-create-shutdown-restart-lock-icons-in-windows-vista/}
+}
+\seealso{
+ \code{\link[base]{system}},\code{\link[base]{shell}},
+ \code{\link[base]{Sys.sleep}}, \code{\link{is.windows}},
+ \code{\link{os.shutdown}}, \code{\link{os.sleep}},
+ \code{\link{os.hibernate}}, \code{\link{os.lock}},
+ \code{\link{os.restart}}
+}
+
View
47 man/os.lock.Rd
@@ -0,0 +1,47 @@
+\name{os.lock}
+\alias{os.lock}
+\title{Locks the operating system (Windows) through a shell command}
+\usage{
+ os.lock(s = 0, m = 0, h = 0)
+}
+\arguments{
+ \item{s}{time to wait before shutting down (in seconds),
+ added to m and h; passed to
+ \code{\link[base]{Sys.sleep}}}
+
+ \item{m}{time to wait before shutting down (in minutes),
+ added to s and h; passed to
+ \code{\link[base]{Sys.sleep}}}
+
+ \item{h}{time to wait before shutting down (in hours),
+ added to s and m; passed to
+ \code{\link[base]{Sys.sleep}}}
+}
+\value{
+ The status code of \code{\link[base]{shell}}.
+}
+\description{
+ This locks Windows after set amount of time.
+}
+\examples{
+\dontrun{
+## when your code is extremely time-consuming, you may need this function to run at the end of the simulation.
+os.lock()
+}
+}
+\author{
+ Tal Galili
+}
+\references{
+ \url{http://superuser.com/questions/42124/how-can-i-put-the-computer-to-sleep-from-command-prompt-run-menu}
+ ,
+ \url{http://www.howtogeek.com/howto/windows-vista/quick-tip-create-shutdown-restart-lock-icons-in-windows-vista/}
+}
+\seealso{
+ \code{\link[base]{system}},\code{\link[base]{shell}},
+ \code{\link[base]{Sys.sleep}}, \code{\link{is.windows}},
+ \code{\link{os.shutdown}}, \code{\link{os.sleep}},
+ \code{\link{os.hibernate}}, \code{\link{os.lock}},
+ \code{\link{os.restart}}
+}
+
View
43 man/os.manage.Rd
@@ -0,0 +1,43 @@
+\name{os.manage}
+\alias{os.manage}
+\title{Gives managing option to the current OS (shutdown, restart, sleep, hibernate, etc...)}
+\usage{
+ os.manage(use_GUI = TRUE, ...)
+}
+\arguments{
+ \item{use_GUI}{a logical indicating whether a graphics
+ menu should be used if available. If TRUE, and on
+ Windows, it will use \link{winDialog}, otherwise it will
+ use \link[utils]{menu}.}
+
+ \item{...}{not in use}
+}
+\value{
+ The status code of \code{\link[base]{system}}.
+}
+\description{
+ A centeral function to run functions for shuting down,
+ restarting, sleeping (etc.) your computer. This will run
+ these functions immediatly.
+}
+\examples{
+\dontrun{
+## when your code is extremely time-consuming, you may need this function; e.g. you go to sleep, and R is running long computation... complex graphics... and long long computation... at last,
+os.manage()
+## the next day you wake up, "thank you, R" :)
+}
+}
+\references{
+ \url{http://superuser.com/questions/42124/how-can-i-put-the-computer-to-sleep-from-command-prompt-run-menu}
+ ,
+ \url{http://www.howtogeek.com/howto/windows-vista/quick-tip-create-shutdown-restart-lock-icons-in-windows-vista/}
+ \url{http://cos.name/en/topic/shut-down-your-windows-with-r}
+}
+\seealso{
+ \code{\link[base]{system}},\code{\link[base]{shell}},
+ \code{\link[base]{Sys.sleep}}, \code{\link{is.windows}},
+ \code{\link{os.shutdown}}, \code{\link{os.sleep}},
+ \code{\link{os.hibernate}}, \code{\link{os.lock}},
+ \code{\link{os.restart}}
+}
+
View
46 man/os.restart.Rd
@@ -0,0 +1,46 @@
+\name{os.restart}
+\alias{os.restart}
+\title{Restarts the operating system (Windows) through a shell command}
+\usage{
+ os.restart(s = 0, m = 0, h = 0)
+}
+\arguments{
+ \item{s}{time to wait before shutting down (in seconds),
+ added to m and h; passed to
+ \code{\link[base]{Sys.sleep}}}
+
+ \item{m}{time to wait before shutting down (in minutes),
+ added to s and h; passed to
+ \code{\link[base]{Sys.sleep}}}
+
+ \item{h}{time to wait before shutting down (in hours),
+ added to s and m; passed to
+ \code{\link[base]{Sys.sleep}}}
+}
+\value{
+ The status code of \code{\link[base]{shell}}.
+}
+\description{
+ This restarts Windows after set amount of time.
+}
+\examples{
+\dontrun{
+os.restart()
+}
+}
+\author{
+ Tal Galili
+}
+\references{
+ \url{http://superuser.com/questions/42124/how-can-i-put-the-computer-to-sleep-from-command-prompt-run-menu}
+ ,
+ \url{http://www.howtogeek.com/howto/windows-vista/quick-tip-create-shutdown-restart-lock-icons-in-windows-vista/}
+}
+\seealso{
+ \code{\link[base]{system}},\code{\link[base]{shell}},
+ \code{\link[base]{Sys.sleep}}, \code{\link{is.windows}},
+ \code{\link{os.shutdown}}, \code{\link{os.sleep}},
+ \code{\link{os.hibernate}}, \code{\link{os.lock}},
+ \code{\link{os.restart}}
+}
+
View
13 man/shutdown.Rd → man/os.shutdown.Rd
@@ -1,8 +1,8 @@
-\name{shutdown}
-\alias{shutdown}
+\name{os.shutdown}
+\alias{os.shutdown}
\title{Shut down the operating system with the command `shutdown'}
\usage{
- shutdown(s = 0, m = 0, h = 0)
+ os.shutdown(s = 0, m = 0, h = 0)
}
\arguments{
\item{s}{time to wait before shutting down (in seconds),
@@ -34,7 +34,7 @@
\examples{
\dontrun{
## when your code is extremely time-consuming, you may need this function; e.g. you go to sleep, and R is running long computation... complex graphics... and long long computation... at last,
-shutdown()
+os.shutdown()
## the next day you wake up, "thank you, R" :)
}
}
@@ -48,6 +48,9 @@ shutdown()
}
\seealso{
\code{\link[base]{system}},\code{\link[base]{shell}},
- \code{\link[base]{Sys.sleep}}, \code{\link{is.windows}}
+ \code{\link[base]{Sys.sleep}}, \code{\link{is.windows}},
+ \code{\link{os.shutdown}}, \code{\link{os.sleep}},
+ \code{\link{os.hibernate}}, \code{\link{os.lock}},
+ \code{\link{os.restart}}
}
View
55 man/os.sleep.Rd
@@ -0,0 +1,55 @@
+\name{os.sleep}
+\alias{os.sleep}
+\title{Sleeps the operating system (Windows) through a shell command}
+\usage{
+ os.sleep(s = 0, m = 0, h = 0,
+ first_turn_hibernate_off = TRUE)
+}
+\arguments{
+ \item{s}{time to wait before shutting down (in seconds),
+ added to m and h; passed to
+ \code{\link[base]{Sys.sleep}}}
+
+ \item{m}{time to wait before shutting down (in minutes),
+ added to s and h; passed to
+ \code{\link[base]{Sys.sleep}}}
+
+ \item{h}{time to wait before shutting down (in hours),
+ added to s and m; passed to
+ \code{\link[base]{Sys.sleep}}}
+
+ \item{first_turn_hibernate_off}{The command rundll32.exe
+ powrprof.dll,SetSuspendState 0,1,0 for sleep is correct -
+ however, it will hibernate instead of sleep if you don't
+ turn the hibernation off. I'm not sure this is true, but
+ that's what is explained in the linke (see bellow)}
+}
+\value{
+ The status code of \code{\link[base]{shell}}.
+}
+\description{
+ This sleeps Windows after set amount of time.
+}
+\examples{
+\dontrun{
+## when your code is extremely time-consuming, you may need this function to run at the end of the simulation.
+os.sleep()
+}
+}
+\author{
+ Tal Galili
+}
+\references{
+ \url{http://superuser.com/questions/42124/how-can-i-put-the-computer-to-sleep-from-command-prompt-run-menu}
+ ,
+ \url{http://www.howtogeek.com/howto/windows-vista/quick-tip-create-shutdown-restart-lock-icons-in-windows-vista/},
+ \url{http://superuser.com/a/135450/28536}
+}
+\seealso{
+ \code{\link[base]{system}},\code{\link[base]{shell}},
+ \code{\link[base]{Sys.sleep}}, \code{\link{is.windows}},
+ \code{\link{os.shutdown}}, \code{\link{os.sleep}},
+ \code{\link{os.hibernate}}, \code{\link{os.lock}},
+ \code{\link{os.restart}}
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.