Permalink
Browse files

move everything over from svn

  • Loading branch information...
rsanheim committed Apr 11, 2008
1 parent 0c29a6a commit c4490ba208e1d1abc01768730acc114c70e9c3ea
Showing with 447 additions and 0 deletions.
  1. +13 −0 admin_scripts/disk_usage
  2. +45 −0 admin_scripts/redhat/init.d/nginx
  3. +97 −0 bash/aliases.sh
  4. +49 −0 bash/ruby.sh
  5. +83 −0 conf/nginx.conf
  6. +160 −0 init/cruise
View
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+MAILTO=you@yourdomain.com
+
+df -h | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;
+do
+ consumed=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
+ partition=$(echo $output | awk '{ print $2 }' )
+ if [ $consumed -ge 95 ]; then
+ echo "Running out of disk space on \"$partition [$consumed% consumed]\" on $(hostname)" |
+ mail -s "[ALERT]: $(hostname) is almost out of disk space" $MAILTO
+ fi
+done
@@ -0,0 +1,45 @@
+#!/bin/sh
+#
+# Startup script for the nginx Server
+#
+# chkconfig: 345 85 15
+# description: nginx is a World Wide Web server.
+# processname: nginx
+# pidfile: /usr/local/nginx/logs/nginx.pid
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+case "$1" in
+ start)
+ echo -n "Starting nginx"
+ /usr/local/sbin/nginx -c /usr/local/nginx/conf/nginx.conf || echo -n " already running"
+ touch /var/lock/subsys/nginx
+ echo
+ ;;
+ stop)
+ echo -n "Stopping nginx"
+ killproc nginx
+ echo
+ rm -f /var/lock/subsys/nginx
+ rm -f /usr/local/nginx/logs/nginx.pid
+ ;;
+ restart)
+ echo -n "Restarting nginx"
+ $0 stop
+ # One second might not be time enough for a daemon to stop,
+ # if this happens, d_start will fail (and dpkg will break if
+ # the package is being upgraded). Change the timeout if needed
+ # be, or change d_stop to have start-stop-daemon use --retry.
+ # Notice that using --retry slows down the shutdown process somewhat.
+ sleep 1
+ $0 start
+ echo "."
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+ ;;
+esac
+
+exit 0
View
@@ -0,0 +1,97 @@
+echo "[ executing aliases.sh ]"
+
+# general shortcuts
+alias c='cd '
+alias mv='mv -i'
+alias rm='rm -i'
+alias :='cd ..'
+alias ::='cd ../..'
+alias :::='cd ../../..'
+alias v='vmstat'
+alias md=mkdir
+
+# Need to do this so you use backspace in screen...I have no idea why
+alias screen='TERM=screen screen'
+
+# listing files
+alias l='ls -al'
+alias lt='ll -t'
+alias la='lt -a'
+alias lth='ll -t|head'
+alias lh='ls -Shl | less'
+alias tf='tail -f'
+alias t500='tail -n 500'
+alias t1000='tail -n 1000'
+alias t2000='tail -n 2000'
+
+# svn
+alias sup='svn up'
+alias sst='svn st'
+alias sstu='svn st -u'
+alias sci='svn ci -m'
+alias sdiff='svn diff | colordiff'
+alias smate='svn diff | mate && svn ci'
+alias sadd="sst | grep '?' | cut -c5- | xargs svn add"
+
+# git
+alias gst='git status'
+alias gl='git pull'
+alias gp='git push'
+alias gd='git diff | mate'
+alias gc='git commit -v'
+alias gca='git commit -v -a'
+alias gb='git branch'
+alias gba='git branch -a'
+
+# git svn
+alias gsr='git svn rebase'
+alias gsd='git svn dcommit'
+
+# editing shortcuts
+alias m='mate'
+alias e='emacs'
+alias erc='e /etc/bashrc'
+alias newrc='. /etc/bashrc'
+alias rsync_nosvn="rsync --exclude=.svn -r "
+alias rsync_novc="rsync --exclude=.svn --exclude=.git -r "
+
+alias sourceit='. ~/src/scripts/profile.d/00_startup.sh'
+
+# mate shortcuts
+alias m8prof='m ~/src/scripts/profile.d/'
+
+# ignore svn metadata - pipe this into xargs to do stuff
+alias no_svn="find . -path '*/.svn' -prune -o -type f -print"
+
+function findfile { find . -name \*$1\*
+}
+function orig { mv $1 orig-$1 ; cp orig-$1 $1; ls -lt $1 orig-$1
+}
+function ps? { ps -aux | grep -i $* | grep -v grep
+}
+
+# Mac style apache control
+# alias htstart='sudo /System/Library/StartupItems/Apache/Apache start'
+# alias htrestart='sudo /System/Library/StartupItems/Apache/Apache restart'
+# alias htstop='sudo /System/Library/StartupItems/Apache/Apache stop'
+
+# Debian style apache control
+alias htreload='sudo /etc/init.d/apache2 reload'
+alias htrestart='sudo /etc/init.d/apache2 restart'
+alias htstop='sudo /etc/init.d/apache2 stop'
+
+# top level folder shortcuts
+alias src='cd ~/src'
+alias docs='cd ~/documents'
+alias scripts='cd ~/src/scripts'
+
+# ssh autocompletion
+SSH_COMPLETE=( $(cat ~/.ssh/known_hosts | \
+cut -f 1 -d ' ' | \
+sed -e s/,.*//g | \
+uniq | \
+egrep -v [0123456789]) )
+complete -o default -W "${SSH_COMPLETE[*]}" ssh
+
+alias h?="history | grep "
+alias ps?="ps aux | grep "
View
@@ -0,0 +1,49 @@
+echo "[ executing ruby.sh ]"
+
+# always load gems for ruby
+export RUBYOPT=rubygems
+
+complete -C ~/src/scripts/bin/rake_autocompletion.rb -o default rake
+
+# ruby shortcuts
+alias gems='cd /opt/local/lib/ruby/gems/1.8/gems'
+
+alias sc='script/console'
+alias ss='script/server'
+alias sg='script/generate'
+
+# testing shortcuts
+alias rt='rake --trace'
+alias rtf='rake test:functionals --trace'
+alias rti='rake test:integration --trace'
+alias rtl='rake test:lib --trace'
+alias rtp='rake test:plugins --trace'
+alias rtu='rake test:units --trace'
+
+alias rrcov='rake coverage:all:test'
+alias rrrcovall='rake test:coverage:all:test'
+
+alias rdm='rake db:migrate'
+alias rdtp='rake db:test:prepare'
+alias rdfl='rake db:fixtures:load'
+
+# unit_record and autotest
+alias autou='autotest'
+alias autof='AUTOTEST=functional autotest'
+
+# capistrano
+alias csd='cap staging deploy'
+
+# open rails code
+alias m8rails125='mate ~/src/rails/rel_1-2-5'
+alias m8rails126='mate ~/src/rails/rel_1-2-6'
+alias m8rails201='mate ~/src/rails/rel_2-0-1'
+alias m8rails202='mate ~/src/rails/rel_2-0-2'
+alias m8railsedge='mate ~/src/rails/trunk'
+alias m8railsstable='mate ~/src/rails/2-0-stable'
+
+# shorten mongrel cluster commands
+# example: cluster_start myapp
+cluster_restart () { mongrel_rails cluster::restart -C /etc/mongrel_cluster/$1.yml;}
+cluster_start () { mongrel_rails cluster::start -C /etc/mongrel_cluster/$1.yml;}
+cluster_stop () { mongrel_rails cluster::stop -C /etc/mongrel_cluster/$1.yml;}
View
@@ -0,0 +1,83 @@
+worker_processes 2;
+error_log /var/www/apps/application/current/log/nginx.error.log debug;
+pid /var/www/apps/application/shared/pids/nginx.pid;
+
+events {
+ worker_connections 1024;
+}
+
+http {
+ include /usr/local/nginx/conf/mime.types;
+ default_type application/octet-stream;
+
+ log_format main '$remote_addr - $remote_user [$time_local] $status '
+ '"$request" $body_bytes_sent "$http_referer" '
+ '"$http_user_agent" "$http_x_forwarded_for"';
+
+ access_log /var/www/apps/application/current/log/nginx.access.log main;
+
+ sendfile on;
+ tcp_nopush on;
+ tcp_nodelay on;
+ keepalive_timeout 70;
+
+ gzip on;
+ gzip_min_length 1000;
+ gzip_buffers 4 8k;
+ gzip_comp_level 9;
+ gzip_proxied any;
+ gzip_types application/xml application/javascript application/x-javascript application/atom+xml application/rss+xml;
+ gzip_types text/css text/html text/javascript text/js text/plain text/xml;
+
+ upstream mongrel {
+ server 127.0.0.1:8000;
+ server 127.0.0.1:8001;
+ }
+
+ server {
+ listen 80;
+ server_name 10.3.16.62;
+ root /var/www/apps/application/current/public;
+ index index.html index.htm;
+
+ location / {
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header Host "10.3.16.62";
+ proxy_redirect false;
+ proxy_max_temp_file_size 0;
+
+ # if static file exists serve now, skip rewrite rules
+ if (-f $request_filename) {
+ expires max;
+ break;
+ }
+ if (-f $request_filename/index.html) {
+ expires 7d;
+ rewrite (.*) $1/index.html break;
+ }
+ # support rails page caching
+ if (-f $request_filename.html) {
+ rewrite (.*) $1.html break;
+ }
+ # pass it onto upstream mongrel cluster
+ if (!-f $request_filename) {
+ proxy_pass http://mongrel;
+ break;
+ }
+ }
+
+ location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov).*?$ {
+ root current_path/public;
+ if (!-f $request_filename) {
+ proxy_pass http://mongrel;
+ break;
+ }
+ }
+
+ error_page 500 502 503 504 /50x.html;
+ location = /50x.html {
+ root /var/www/apps/application/current/public;
+ }
+ }
+}
Oops, something went wrong.

0 comments on commit c4490ba

Please sign in to comment.