Advertisement
Guest User

/etc/init/mysql.conf

a guest
Mar 10th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.13 KB | None | 0 0
  1. # MySQL Service
  2.  
  3. description     "MySQL Server"
  4. author          "Mario Limonciello <superm1@ubuntu.com>"
  5.  
  6. start on runlevel [2345]
  7. stop on starting rc RUNLEVEL=[016]
  8.  
  9. respawn
  10. respawn limit 2 5
  11.  
  12. env HOME=/etc/mysql
  13. umask 007
  14.  
  15. # The default of 5 seconds is too low for mysql which needs to flush buffers
  16. kill timeout 300
  17.  
  18. pre-start script
  19.     #Sanity checks
  20.     [ -r $HOME/my.cnf ]
  21.     [ -d /var/run/mysqld ] || install -m 755 -o mysql -g root -d /var/run/mysqld
  22.     /lib/init/apparmor-profile-load usr.sbin.mysqld
  23.     LC_ALL=C BLOCKSIZE= df --portability /var/lib/mysql/. | tail -n 1 | awk '{ exit ($4<4096) }'
  24. end script
  25.  
  26. exec /usr/sbin/mysqld
  27.  
  28. post-start script
  29.    for i in `seq 1 30` ; do
  30.         /usr/bin/mysqladmin --defaults-file="${HOME}"/debian.cnf ping && {
  31.             exec "${HOME}"/debian-start
  32.             # should not reach this line
  33.             exit 2
  34.         }
  35.         statusnow=`status`
  36.         if echo $statusnow | grep -q 'stop/' ; then
  37.             exit 0
  38.         elif echo $statusnow | grep -q 'respawn/' ; then
  39.             exit 1
  40.         fi
  41.         sleep 1
  42.     done
  43.     exit 1
  44. end script
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement