The title says it all…
Hi all,
I made a Chrome extension for Paperspace that notifies you each hour an instance is running. Makes it easier to remember.
The source is public here
Hope it’s helpful to you.
I used a cron job to shutdown my AWS instance after 180 mins of booting. The Steps I used are:
- Create a file on AWS EC2 /home/ubuntu/anotherfile.sh and paste the following:
#!/bin/bash
/sbin/shutdown -h +15 “Shutting down at: $(date --date=‘15 minutes’)”
One can give command shutdown -c to get some more time. Thanks @gamo
- Create one more file /home/ubuntu/firstfile.sh and paste:
#!/bin/bash
at -f /home/ubuntu/anotherfile.sh now + 180 minutes
- Give command
sudo crontab -e
and at the end of the file append:
@reboot /home/ubuntu/firstfile.sh
Took this approach from: https://superuser.com/a/1012177/120824
You can find Cloud Console for android and ios.
The app allows controlling the VM from your mobile (and much more!). For this topic’s concern, shutting vm instances down.
Salamander will email you if your server has remained idle for an hour (no active ssh connection, low cpu/gpu utilisation)
Azure has an auto shutdown option for VMs that you can set on a schedule - which can notify you via web hook or e-mail before it shuts down. Worth having as a backstop - although choosing the right time when it kicks in can be challenging when you might still be working to get that extra ,1% accuracy at 2am… I do find the Azure mobile app useful too - as I can start my VM from anywhere in anticipation of more data science goodness! Or shut it down if I forgot and don’t want to wait.
Found this article: http://rohitrawat.com/automatically-shutting-down-google-cloud-platform-instance/
It is for GCP, but all commands are linux/bash so it should work on similar systems.
With a bit of editing it could be made more dynamic and to work with cron.
For Google Cloud, I’m using a preemptible instance, so it can live at most 24 hours anyway. However, I don’t want to waste my credits, so I’ve set a cronjob to automatically shut it down everyday at a given time.
sudo crontab -e
then add this line to the end of the file
30 22 * * * /sbin/shutdown -h now
This shuts the system down at 22:30 (10:30pm)
Could be good to use shutdown -h +15 "Shutting down at: $(date --date='15 minutes')"
giving you some time to run shutdown -c
if you are using the instance and don’t want to lose data.
Alternatively run a script that saves data/cleans up and then shuts down.
This is such a useful advise. Thanks!
Is there a way to do something like this with crestle? had my first “forget to shut down” experience, just a few bucks but want to avoid it in the future