Skip to content

Instantly share code, notes, and snippets.

Tom Rosenfeld AstroTom

  • WishTrip
Block or report user

Report or block AstroTom

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@AstroTom
AstroTom / live-server
Created May 29, 2018
live-server startup script to be installed in /etc/init.d
View live-server
#!/bin/sh
# May 2018
# removed iptables and just run directly on port 443
# added RNT_ENV
#
#
# read in wishtrip config file for value of RNT_ENV etc
#
@AstroTom
AstroTom / wishtrip-service-skel
Created May 14, 2018
wishtrip startup skeleton
View wishtrip-service-skel
#
# all wishtrip services (controller, jobexec, gate) should have the following near the top of the service starup script
#
RNT_CONFIG_FILE=/etc/rnt.conf
# read in wishtrip config file for value of RNT_ENV etc
if [ -s $RNT_CONFIG_FILE ]; then
. $RNT_CONFIG_FILE
@AstroTom
AstroTom / wishtrip-boot
Created May 14, 2018
wishtrip boot script to run program at startup
View wishtrip-boot
#! /bin/bash
# Name - wishtrip-boot
#
# wishtrip boot script to run program at startup
# to be installed as boot service
#
# Install as a (early) service with:
# update-rc.d wishtrip-boot defaults 05
# Remove with:
@AstroTom
AstroTom / register-from-tags.sh
Last active Jul 5, 2018
Register DNS and variables from TAGS of instance
View register-from-tags.sh
#! /bin/bash
# Last update 2018-06-21 v0.2
# Author: Tom R.
#
# wishtrip-register-from-tags.sh - Register DNS and variables from TAGS of instance
# 1) get tags into env and then register DNS
# 2) create /etc/rnt.conf with value of RNT_ENV from "Env" tag
# 3) Set the hostname from tag "Hostname"
# 4) Set the DNS in route53 from tags "Host" and "Env"
@AstroTom
AstroTom / add-dns-record.sh
Last active May 10, 2018 — forked from justinclayton/add-dns-record.sh
CLI to add DNS Records in Route53
View add-dns-record.sh
#!/bin/bash
set -eo pipefail
## Allows for creation of "Basic" DNS records in a Route53 hosted zone
# Make sure all output is in json
export AWS_DEFAULT_OUTPUT=json
function main() {
View property.sh
#
# sample property file
# illustrates more flexible way to define variables based on Environemnt
#
# Assume external variable $RNT_ENV
#
# current system
# only works for 3 environments
@AstroTom
AstroTom / stop-if-inactive.sh
Last active Aug 20, 2018
Shutdown EC2 instance after timeout if no one is connected via ssh
View stop-if-inactive.sh
#!/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
@AstroTom
AstroTom / sqs.sh
Last active May 14, 2019
sample AWS sqs in CLI
View sqs.sh
# Create Q
ENV=dev1
Qname=tom-test1
Q1=$(aws sqs create-queue --queue-name "$ENV-$Qname" --output text)
echo $Q1
aws sqs send-message --queue-url $Q1 --message-body "Test message 1 from Tom"
You can’t perform that action at this time.