Skip to content

Instantly share code, notes, and snippets.

View jns's full-sized avatar

Joshua Shapiro jns

View GitHub Profile
@jns
jns / stop-if-idle.sh
Last active February 11, 2022 15:47
Bash script that stops an ec2 instance after 12 consecutive invocations without established ssh connection or screens
#!/bin/bash
# This script will check for the absence of any logged in user for 12 consecutive
# invocations. If the no user has logged in for 12 consecutive invocations then
# the EC2 instance will stop or hibernate depending on its configuration
# The ec2 instance profile must have permission to stop an ec2 instance.
#
# Copy this script to /usr/local/bin and make it executable
# Then add the following line to your crontab.
#
@jns
jns / keybase.md
Last active July 31, 2020 19:38
Keybase proof

Keybase proof

I hereby claim:

To claim this, I am signing this object: