Am 20.03.2015 um 22:44 schrieb Kai Krakow:
I've found the bug report on Fedora bugzilla you were involved with [1]. I
guess that socket activation did not work out? I tried that also way back
when I started using systemd and it didn't really work for me.

Besides that your solution works fine for me. It also has the benefit of not
duplicating configuration items like sockets and ports - which would
probably be a problem with using a mysqld.socket file

well, i have a ton of machines with more than one mysqld-instance on different ports, mostly backup/replication instances and so on or a own instance for dbmail to synch machines except the mail storage (home / office workstation and so on)

clone the mysqld-ready script with the same suffix and change path inside is easy
______________________________________

BTW mine don't use sleep since usleep exists :-)

#!/usr/bin/bash

# Service file passes us the daemon's PID
daemon_pid="$1"

# Wait for the server to come up or for the mysqld process to disappear
ret=0
while /usr/bin/true; do
RESPONSE=`/usr/bin/mysqladmin --defaults-file=/etc/my.cnf --socket=/var/lib/mysql/mysql.sock --user=UNKNOWN_MYSQL_USER ping 2>&1`
 mret=$?
 if [ $mret -eq 0 ]; then
  break
 fi
 # exit codes 1, 11 (EXIT_CANNOT_CONNECT_TO_SERVICE) are expected,
 # anything else suggests a configuration error
 if [ $mret -ne 1 -a $mret -ne 11 ]; then
  ret=1
  break
 fi
 # "Access denied" also means the server is alive
 echo "$RESPONSE" | grep -q "Access denied for user" && break

 # Check process still exists
 if ! /usr/bin/kill -0 $daemon_pid 2>/dev/null; then
  ret=1
  break
 fi
 usleep 100000
done

exit $ret

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to