Skip to content

Instantly share code, notes, and snippets.

@lukebrowell
lukebrowell / stop-if-inactive.sh
Created May 14, 2018 14:51 — forked from AstroTom/stop-if-inactive.sh
Shutdown EC2 instance after timeout if no one is connected via ssh
#!/bin/bash
# based on AWS Cloud9
# shutdown ec2 if no ssh connections after 1/2 hour
# Add to cron to run every minute
# User needs sudo permission to run 'shutdown'
#
set -euo pipefail