44 lines
1.1 KiB
Plaintext
44 lines
1.1 KiB
Plaintext
# MySQL Service
|
|
|
|
description "MySQL Server"
|
|
author "Mario Limonciello <superm1@ubuntu.com>"
|
|
|
|
#start on runlevel [2345]
|
|
stop on starting rc RUNLEVEL=[016]
|
|
|
|
respawn
|
|
respawn limit 2 5
|
|
|
|
env HOME=/etc/mysql
|
|
umask 007
|
|
|
|
# The default of 5 seconds is too low for mysql which needs to flush buffers
|
|
kill timeout 300
|
|
|
|
pre-start script
|
|
#Sanity checks
|
|
[ -r $HOME/my.cnf ]
|
|
[ -d /var/run/mysqld ] || install -m 755 -o mysql -g root -d /var/run/mysqld
|
|
/lib/init/apparmor-profile-load usr.sbin.mysqld
|
|
LC_ALL=C BLOCKSIZE= df --portability <%= node['mysql']['data_dir'] %>/. | tail -n 1 | awk '{ exit ($4<4096) }'
|
|
end script
|
|
|
|
exec /usr/sbin/mysqld
|
|
|
|
post-start script
|
|
for i in `seq 1 30` ; do
|
|
/usr/bin/mysqladmin --defaults-file="${HOME}"/debian.cnf ping && {
|
|
exec "${HOME}"/debian-start
|
|
# should not reach this line
|
|
exit 2
|
|
}
|
|
statusnow=`status`
|
|
if echo $statusnow | grep -q 'stop/' ; then
|
|
exit 0
|
|
elif echo $statusnow | grep -q 'respawn/' ; then
|
|
exit 1
|
|
fi
|
|
sleep 1
|
|
done
|
|
exit 1
|
|
end script |