[debian-mysql] Bug#842011: Bug#842011: default-mysql-client forces removal of mysql-server* and mysql-client*
Craig Sanders
cas at taz.net.au
Wed Oct 26 01:56:43 UTC 2016
On Tue, Oct 25, 2016 at 06:42:11AM -0700, Lars Tangvald wrote:
> SysV and upstart scripts use mysqladmin (which is in the client) to verify
> that the server is running. 5.7 has some inbuilt support for systemd, so for
> systemd at least it's not needed.
pgrep (or even telnet to port 3306) would probably be better.
but neither of those are Essential, and neither is netstat, so to avoid
another dependency, using bash's /dev/tcp built-in would probably be better.
mysql's init.d script is already bash rather than sh, and this is a bash
feature which has existed since version 2.04 (although it was disabled in
debian until around 2009 IIRC)
some google results on the topic:
http://hacktux.com/bash/socket
http://www.linuxjournal.com/content/more-using-bashs-built-devtcp-file-tcpip
probably don't need to get a meaningfule result, just check to see there's
something listening on port 3306 (or whatever's defined in my.cnf)
#! /bin/bash
( exec 3<>/dev/tcp/localhost/3306 ) >& /dev/null
echo $?
wrapped in a subshell to avoid spamming stderr if nothing's listening.
craig
--
craig sanders <cas at taz.net.au>
More information about the pkg-mysql-maint
mailing list