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/sudoersfile withNOPASSWDto allow such unsupervised action, for example:Then simply halt the computer with a
systemcall, for example: