$ rails g model User
belongs_to
has_one
| #!/bin/bash | |
| #set -x | |
| #DEBUG=echo | |
| # Runs via cron to shut down the instance if it's not in use for 5 minutes | |
| # Starts checks after it's been up more than 500secs | |
| # Won't kick you out if you're ssh'ed in and it's idle. | |
| # crontab -l|grep idle | |
| # */6 * * * * /root/bin/idle.sh >/dev/null 2>&1 | |
| until $(awk '$1>500{exit 1}' /proc/uptime) |
| NODE="a hostname" | |
| IFS=$'\n' | |
| for line in $(curl -s 'localhost:9200/_cat/shards' | fgrep UNASSIGNED); do | |
| INDEX=$(echo $line | (awk '{print $1}')) | |
| SHARD=$(echo $line | (awk '{print $2}')) | |
| curl -XPOST 'localhost:9200/_cluster/reroute?pretty' -d '{ | |
| "commands": [ | |
| { | |
| "allocate": { |
| #!/bin/bash | |
| # Dashing service | |
| # Add this file to /etc/init.d/ | |
| # $ sudo cp dashboard /etc/init.d/ | |
| # Update variables DASHING_DIR, GEM_HOME, & PATH to suit your installation | |
| # $ sudo nano /etc/init.d/dashboard | |
| # Make executable | |
| # $ sudo chmod 755 /etc/init.d/dashboard | |
| # Update rc.d | |
| # $ sudo update-rc.d dashboard defaults |
| # encoding: UTF-8 | |
| require 'optparse' | |
| require 'net/http' | |
| require 'json' | |
| def parse_options(argv) | |
| opts = {} | |
| @parser = OptionParser.new do |o| |