This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CMD="ps -ef | grep resque | grep -v grep" | |
| for R_E in production staging demo | |
| do | |
| echo "${R_E}" | |
| ey ssh "${CMD}" -e ${R_E} --utilities=utility | |
| echo "${R_E}" | |
| echo "-------------------------------" | |
| done | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ps -ef | grep sidek | grep -v grep | cut -c10-14 | grep -v tail| xargs kill -TTIN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #This version is non-interactive. Just put in your bucket in file in same dir. | |
| bucket = `cat prodbucket.txt`.strip | |
| list = `sudo /usr/local/ey_resin/bin/eybackup -l BAM -e mysql -b #{bucket}` | |
| #puts list.split("\n") | |
| #exit | |
| latest_file = list.split('\n').first.split("\n").select{|ea| ea =~ /^[0-9]*:/}.last | |
| latest_index = latest_file.split(":").first | |
| puts "Downloading #{latest_file}" | |
| `sudo /usr/local/ey_resin/bin/eybackup -e mysql -d #{latest_index}:BAM -b #{bucket}` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @conn = Sidekiq.redis {|conn| @conn = conn} | |
| @conn.smembers('queues').each {|q| | |
| File.open("/home/rails/#{q}_sidekiq.dump",'w') {|f| | |
| l = @conn.lrange("queue:#{q}",0,-1) | |
| f << l | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/ruby | |
| if ARGV.size < 1 | |
| puts "you need to supply bucket" | |
| exit | |
| end | |
| bucket = ARGV[1] | |
| puts "fetching list of prod backups" | |
| list = `sudo /usr/local/ey_resin/bin/eybackup -l BAM -e mysql -b #{bucket}` | |
| puts list.split("\n") | |
| latest_file = list.split('\n').first.split("\n").select{|ea| ea =~ /^[0-9]*:/}.last |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def self.counth(thehash,count=0) | |
| count += thehash.keys.size if thehash.is_a? Hash | |
| thehash.keys.each do |key| | |
| if thehash[key].is_a? Hash | |
| count = counth(thehash[key],count) | |
| end | |
| end | |
| count | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE USER 'joe'@'%' IDENTIFIED BY 'xxxxxx'; | |
| # ALL PRIVILEGES is everything except grant | |
| GRANT ALL PRIVILEGES ON APP_production_temp.* TO 'joe'@'%'; | |
| GRANT SELECT ON APP_production.* TO 'joe'@'%'; | |
| GRANT SELECT ON stats_production.* TO 'joe'@'%'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ls | egrep -e '^[a-z0-9]{8}-.*' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type redis-cli > /dev/null 2>&1 ; echo $? | |
| # used in python like so: | |
| # IS_REDIS_SERVER = int(commands.getoutput("type redis-cli > /dev/null 2>&1 ; echo $?")) == 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Forking view of ps | |
| ps axjf | |
| # inspect a single process | |
| ps -p 20673 -F |