Skip to content

Instantly share code, notes, and snippets.

View simplyadrian's full-sized avatar
:shipit:
brooding

Adrian Herrera simplyadrian

:shipit:
brooding
  • Minneapolis, MN
  • 01:31 (UTC -05:00)
View GitHub Profile
@simplyadrian
simplyadrian / install_s3_gem.sh
Last active August 29, 2015 14:21
install s3 via RightScale
#!/bin/bash
#
# Test for a reboot, if this is a reboot just skip this script.
#
if test "$RS_REBOOT" = "true" -o "$RS_ALREADY_RUN" = "true" ; then
logger -t RightScale "AWS::S3 install, skipped on a reboot."
exit 0
fi
@simplyadrian
simplyadrian / s3cp.rb
Last active August 29, 2015 14:21
a ruby script to copy files from local filesystem to s3 with s3cp
#!/usr/bin/env ruby
require 'rubygems'
require 'aws/s3'
local_file = ARGV[0]
bucket = ARGV[1]
mime_type = ARGV[2] || "application/octet-stream"
AWS::S3::Base.establish_connection!(
@simplyadrian
simplyadrian / ssmtp.sh
Last active August 29, 2015 14:21
bash script to setup gmail and ssmtp
#!/bin/bash -ex
#
if test "$RS_REBOOT" = "true" -o "$RS_ALREADY_RUN" = "true" ; then
logger -t RightScale "ssmtp Install, skipped on a reboot."
exit 0
fi
#Create backup of conf file
ssmtp_file=/etc/ssmtp/ssmtp.conf
@simplyadrian
simplyadrian / apache_force_https.sh
Last active August 29, 2015 14:21
Bash script to force https in apache
#!/bin/bash -x
#
# Linux detection
#
if [ -e /usr/bin/lsb_release ]; then
case `lsb_release -si` in
Ubuntu*) export RS_DISTRO=ubuntu
export RS_BASE_OS=debian
@simplyadrian
simplyadrian / apache_vhost.sh
Last active August 29, 2015 14:21
bash script to create vhosts in apache
#!/bin/bash -e
#
#
# Test for a reboot, if this is a reboot just skip this script.
#
if test "$RS_REBOOT" = "true" -o "$RS_ALREADY_RUN" = "true" ; then
logger -t RightScale "WEB Apache ocs vhost, skipped on a reboot."
exit 0
fi
@simplyadrian
simplyadrian / archiva_install.sh
Last active August 29, 2015 14:21
bash script to install archiva
#!/bin/bash -e
# Package requirements: archiva
#Archiva home directory: Recommended directory is "/mnt/storage1/"
if test "$RS_REBOOT" = "true" -o "$RS_ALREADY_RUN" = "true" ; then
logger -t RightScale "Archiva Install, skipped on a reboot."
exit 0
fi
@simplyadrian
simplyadrian / backup_to_s3.rb
Last active August 29, 2015 14:21
a ruby script to backup a mediawiki site to an s3 bucket
#!/bin/env ruby
require 'rubygems'
require 'aws/s3'
# Create a tar file with the wiki data files.
wiki_data = '/mnt/ephemeral'
target_dirs = ['mediawiki','log','www']
tar_dirs = ''
target_dirs.each do |dir|
@simplyadrian
simplyadrian / install_app_new_relic_RPM_for_php.sh
Created May 12, 2015 06:27
a bash script to install the new relic client.
#!/bin/bash -e
#
# Test for a reboot, if this is a reboot just skip this script.
#
if test "$RS_REBOOT" = "true" ; then
logger -t RightScale "New Relic PHP Agent install, skipped on a reboot.";
exit 0;
fi
@simplyadrian
simplyadrian / r53_Create_records.rb
Created May 12, 2015 06:30
a ruby script to create a route53 record
#! /usr/bin/ruby
require 'rubygems'
require 'aws-sdk'
r53 = AWS::Route53.new(
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'])
response = r53.client.list_resource_record_sets(
@simplyadrian
simplyadrian / install_jenkins.sh
Created May 12, 2015 06:34
a bash script to install Jenkins
#!/bin/bash -e
# Package requirements: jenkins
# Test for a reboot, if this is a reboot just skip this script.
#
if test "$RS_REBOOT" = "true" -o "$RS_ALREADY_RUN" = "true" ; then
logger -t RightScale "Jenkins Install, skipped on a reboot."
exit 0
fi