Turn Off The Lights

After upgrading to macOS Sierra, and having Apex fail to work locally anymore, I decided it was time to build a dev instance, on EBS within EC2. I found a good idea from CloudSSH, but I really wanted to allow my instance to run docker commands while I was away. I decided to add the "--no-stop" flag to CloudSSH and just handle terminating the instances myself using a cronscript.

Here's the script:

# Don't even bother checking if we haven't been up for more than
# 3500 seconds (just under 1 hour)
UPTIME=`cat /proc/uptime|awk '{printf "%i", $1}'`
if [ "$UPTIME" -gt "3500" ]
  if [ -z "$(who)" ]
    if [ -z "$(docker ps -q)" ]
      shutdown -P now


And here's the /etc/cron.d/turn-off-the-lights file:

*/5 * * * * root /usr/local/bin/turn-off-the-lights

I also set up a nice little bash function to handle automatically configuring most of the common things I did for CloudSSH. I did this instead of an alias because I have multiple AWS profiles that I connect to:

# Connect to a "Cloud Environment"
  export AWS_REGION=us-east-1
  export AWS_PROFILE=$1
  $HOME/bin/cloudssh --no-stop ec2-user@${CLOUD_INSTANCE_ID[$1]}.us-east-1 -- -i ~/.ssh/$1-cmoyer.pem -o HostKeyAlias=${CLOUD_INSTANCE_ID[$1]}
cloud_profiles=(aci newstex)
compctl -k cloud_profiles cloud

Now I can just type "cloud aci" and automatically get logged into my ACI dev instance. Note that using "HostKeyAlias" allows me to not have to re-verify the host key every time the IP address changes.


There is also our famous QA team, checking on zipjob review every essay and paper written by our writers before sending the final draft over to a customer.
unknown said…
Before the writer, I was the best developer but recently I changed our field for some issues. When the last week also took law writing service from the best law essay writing services Manchester the reason is that I'm not a professional in the law writing.
hastenchemical said…
Taking inspiration from CloudSSH and customizing it with the "--no-stop" flag demonstrates resourcefulness in allowing for uninterrupted usage of Docker commands. Similarly, Refrigerated Courier Services – Texas provide customized and reliable transportation solutions for temperature-sensitive goods, adapting to specific needs and ensuring seamless delivery across different locations and timeframes.
Steven Paul said…
It's impressive that you were able to adjust to macOS Sierra's new features and find a workaround for your development instance on EBS within EC2. Instance termination is handled by a cron script, and the addition of the "--no-stop" argument to CloudSSH demonstrates your proactive nature. The Fast X Jason Statham Beige Jacket is a great addition to your wardrobe if you're looking to step up your fashion game.

Vava Store said…
It is very awesome to know about that. I appreciate your blog. however, the Vava store is where you can find your favorite character jackets the Spider man tuxedo is a stylish and unique take on traditional formal attire. shop now at the Vava store with the best quality jackets.
Not only will turning off the lights save you money on your utility bills, but it will also promote a sense of responsibility and mindfulness in your daily life. By actively participating in this simple act, you are setting an example for others to follow.

So, let's take my online class for me on turning off the lights. Together, we can make a difference by embracing this easy habit that will benefit us all in the long run. Remember, every small action counts towards creating a brighter future for generations to come.