[systemd-devel] Boot ordering

Reindl Harald h.reindl at thelounge.net
Fri Mar 20 14:52:06 PDT 2015



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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150320/94352da2/attachment-0001.sig>


More information about the systemd-devel mailing list