mysql.conf 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. description "MySQL 5.6 Server"
  2. author "Mario Limonciello <[email protected]>"
  3. start on runlevel [2345]
  4. stop on starting rc RUNLEVEL=[016]
  5. respawn
  6. respawn limit 2 5
  7. env HOME=/etc/mysql
  8. umask 007
  9. # The default of 5 seconds is too low for mysql which needs to flush buffers
  10. kill timeout 300
  11. pre-start script
  12. ## Fetch a particular option from mysql's invocation.
  13. # Usage: void mysqld_get_param option
  14. mysqld_get_param() {
  15. /usr/sbin/mysqld --print-defaults \
  16. | tr " " "\n" \
  17. | grep -- "--$1" \
  18. | tail -n 1 \
  19. | cut -d= -f2
  20. }
  21. # priority can be overriden and "-s" adds output to stderr
  22. ERR_LOGGER="logger -p daemon.err -t /etc/init/mysql.conf -i"
  23. #Sanity checks
  24. [ -r $HOME/my.cnf ]
  25. [ -d /var/run/mysqld ] || install -m 755 -o mysql -g root -d /var/run/mysqld
  26. /lib/init/apparmor-profile-load usr.sbin.mysqld
  27. # check for diskspace shortage
  28. # datadir=`mysqld_get_param datadir`
  29. # BLOCKSIZE=`LC_ALL=C df --portability $datadir/. | tail -n 1 | awk '{print $4}'`
  30. # if [ $BLOCKSIZE -le 4096 ] ; then
  31. # echo "$0: ERROR: The partition with $datadir is too full!" >&2
  32. # echo "ERROR: The partition with $datadir is too full!" | $ERR_LOGGER
  33. # exit 1
  34. # fi
  35. end script
  36. exec /usr/sbin/mysqld
  37. post-start script
  38. for i in `seq 1 30` ; do
  39. /usr/bin/mysqladmin --defaults-file="${HOME}"/debian.cnf ping && {
  40. exec "${HOME}"/debian-start
  41. # should not reach this line
  42. exit 2
  43. }
  44. statusnow=`status`
  45. if echo $statusnow | grep -q 'stop/' ; then
  46. exit 0
  47. elif echo $statusnow | grep -q 'respawn/' ; then
  48. exit 1
  49. fi
  50. sleep 1
  51. done
  52. exit 1
  53. end script