Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (19.1k points)

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

How should I go about this?

1 Answer

0 votes
by (44.4k points)

You can add your username and add NOPASSWD in the /etc/sudoers file. This will allow unsupervised action, for instance:

username ALL = NOPASSWD: /sbin/shutdown

halt the computer later with a system call like this:

system('sudo shutdown -h now', wait = FALSE)

Related questions

0 votes
1 answer

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

Browse Categories