[DRE-commits] [ruby-moneta] 01/02: Be more aggressive when shutting down MySQL test instances
Jérémy Bobbio
lunar at moszumanska.debian.org
Fri May 9 08:29:57 UTC 2014
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch master
in repository ruby-moneta.
commit 78f28dcaa2e8e497893d96f20e0acb8fad3b5d79
Author: Jérémy Bobbio <lunar at debian.org>
Date: Fri May 9 09:33:17 2014 +0200
Be more aggressive when shutting down MySQL test instances
Closes: #746373
---
debian/control | 2 +-
debian/setup-mysql.sh | 24 +++++++++++++++++++++++-
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/debian/control b/debian/control
index d7ccad8..a2aa086 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: ruby
Priority: extra
Maintainer: Joshua Timberman <joshua at opscode.com>
Uploaders: Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers at lists.alioth.debian.org>
-Build-Depends-Indep: debhelper (>= 8), gem2deb (>= 0.3.0~), ruby-setup, ruby-rspec (>= 2.11), ruby-rspec-retry, ruby-activesupport-3.2 (>= 3.2.11~), ruby-sequel, ruby-mysql2, ruby-sqlite3, ruby-kyotocabinet, ruby-tokyocabinet, ruby-multi-json, ruby-fog, ruby-rack, ruby-rack-cache, mysql-server, netcat
+Build-Depends-Indep: debhelper (>= 8), gem2deb (>= 0.3.0~), ruby-setup, ruby-rspec (>= 2.11), ruby-rspec-retry, ruby-activesupport-3.2 (>= 3.2.11~), ruby-sequel, ruby-mysql2, ruby-sqlite3, ruby-kyotocabinet, ruby-tokyocabinet, ruby-multi-json, ruby-fog, ruby-rack, ruby-rack-cache, mysql-server, netcat, lsof
Standards-Version: 3.9.5
Vcs-Git: git://anonscm.debian.org/pkg-ruby-extras/ruby-moneta.git
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-ruby-extras/ruby-moneta.git
diff --git a/debian/setup-mysql.sh b/debian/setup-mysql.sh
index 491af10..82d4a6e 100755
--- a/debian/setup-mysql.sh
+++ b/debian/setup-mysql.sh
@@ -27,7 +27,29 @@ mysqld="/usr/sbin/mysqld --no-defaults --user=$user --bind-address=127.0.0.1 --p
# Main code #
if [ "$action" = "stop" ]; then
- $mysqladmin shutdown
+ if $mysqladmin ping 2>/dev/null; then
+ pid=$(lsof -Fp -n -i TCP:$port -s TCP:LISTEN | sed -n -s 's/^p//p')
+ if [ -z "$pid" ]; then
+ echo "Unable to find MySQL port" >&2
+ exit 1
+ fi
+ $mysqladmin shutdown || true
+ for i in 1 2 3 4 5 6 7 8 9 10; do
+ sleep 1
+ if ! $mysqladmin ping 2>/dev/null; then
+ exit
+ fi
+ done
+ echo "Killing MySQL database server by signal" >&2
+ kill -15 $pid
+ for i in 1 2 3 4 5 6 7 8 9 10; do
+ sleep 1
+ if ! $mysqladmin ping 2>/dev/null; then
+ exit
+ fi
+ done
+ kill -9 $pid
+ fi
exit
fi
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-moneta.git
More information about the Pkg-ruby-extras-commits
mailing list