logoalt Hacker News

hendiatristoday at 2:39 PM2 repliesview on HN

I run

sudo shutdown +15 (or other amount of minutes)

when I need a compute instance and don’t want to forget to turn it off. It’s a simple trick that will save you in some cases.


Replies

apawloskitoday at 3:26 PM

For expensive GPU instances I have a crontab one-liner that shuts the node down after 2 hours if I don't touch an override file (/var/run/keepalive).

/5 * * * [ -f /var/run/keepalive ] && [ $(( $(date +\%s) - $(stat -c \%Y /var/run/keepalive) )) -gt 7200 ] && shutdown -h now

tlntoday at 3:20 PM

Sort of like cancelling Disney right after signing up for the free trial.. nice!