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