Sha256: dc2beeb709f15282d4d7b83990db7a6937d23563a8a728fb36f05ab14b65663b

Contents?: true

Size: 395 Bytes

Versions: 12

Compression:

Stored size: 395 Bytes

Contents

# frozen_string_literal: true
if Rails.env.development?
  namespace :db do
    desc 'Kill Postgres connections'
    task kill_postgres_connections: :environment do
      db_name = "#{File.basename(Rails.root)}_#{Rails.env}"
      sh = <<EOF
ps xa \
  | grep postgres: \
  | grep #{db_name} \
  | grep -v grep \
  | awk '{print $1}' \
  | sudo xargs kill
EOF
      puts `#{sh}`
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
onotole-2.0.2 templates/kill_postgress_conections.rake
onotole-2.0.1 templates/kill_postgress_conections.rake
onotole-2.0.0 templates/kill_postgress_conections.rake
onotole-1.2.11 templates/kill_postgress_conections.rake
onotole-1.2.10 templates/kill_postgress_conections.rake
onotole-1.2.9 templates/kill_postgress_conections.rake
onotole-1.2.8 templates/kill_postgress_conections.rake
onotole-1.2.7 templates/kill_postgress_conections.rake
onotole-1.2.6 templates/kill_postgress_conections.rake
onotole-1.2.5 templates/kill_postgress_conections.rake
onotole-1.2.4 templates/kill_postgress_conections.rake
onotole-1.2.3 templates/kill_postgress_conections.rake