installr (version 0.21.0)

os.shutdown: Shut down the operating system with the command `shutdown'

Description

There is a command shutdown in both Windows and Linux, and this function uses it to shut down a computer.

After the time wait has passed, R will execute shutdown -s -t 0 (for Windows) or shutdown -h now to shut down the computer.

This function is a modified version of Yihui's shutdown function from the fun package.

Usage

os.shutdown(s = 0, m = 0, h = 0)

Arguments

s

time to wait before shutting down (in seconds), added to m and h; passed to Sys.sleep

m

time to wait before shutting down (in minutes), added to s and h; passed to Sys.sleep

h

time to wait before shutting down (in hours), added to s and m; passed to Sys.sleep

Value

The status code of system.

References

https://github.com/yihui/fun/blob/master/R/shutdown.R

See Also

system,shell, Sys.sleep, is.windows, os.shutdown, os.sleep, os.hibernate, os.lock, os.restart

Examples

Run this code
# NOT RUN {
## when your code is extremely time-consuming, 
# you may need this function; 
# e.g. you wish to go to sleep, while keeping R running long computation...

os.shutdown()
## the next day you wake up, "thank you, R" :)
# }

Run the code above in your browser using DataCamp Workspace