문제

I set up RStudio Server on an Amazon EC2 instance, which is charged by hour. I have to run long jobs overnight on this instance regularly. I would like to stop EC2 server when my R job is done to avoid charges for the hours I don't use.

How should I go about this?

도움이 되었습니까?

해결책

You might add your (Unix) username (which you use to log into the RStudio Server) to the /etc/sudoers file with NOPASSWD to allow such unsupervised action, for example:

username ALL = NOPASSWD: /sbin/shutdown

Then simply halt the computer with a system call, for example:

system('sudo shutdown -h now', wait = FALSE)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top