Permalink
Browse files

put silverline names and tags in upstart script too

  • Loading branch information...
1 parent 79505b7 commit 673e2139c887253035a2c7647ca5d7875f95a632 Ulf Harnhammar committed Sep 26, 2012
Showing with 51 additions and 0 deletions.
  1. +6 −0 mysql/recipes/silverline.rb
  2. +45 −0 mysql/templates/default/mysql.conf.erb
@@ -5,3 +5,9 @@
mode "0755"
notifies :restart, resources( :service => "mysql")
end
+
+template "/etc/init/mysql.conf" do
+ source "mysql.conf.erb"
+ mode "0644"
+ notifies :restart, resources( :service => "mysql")
+end
@@ -0,0 +1,45 @@
+# MySQL Service
+
+description "MySQL Server"
+author "Mario Limonciello <superm1@ubuntu.com>"
+
+start on (net-device-up
+ and local-filesystems
+ and runlevel [2345])
+stop on runlevel [016]
+
+respawn
+
+env HOME=/etc/mysql
+env SL_NAME=<%= node[:silverline][:name] %>
+env SL_TAG_NAMES=<%= node[:silverline][:sl_tag_names] %>
+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
+ # Load AppArmor profile
+ if aa-status --enabled 2>/dev/null; then
+ apparmor_parser -r /etc/apparmor.d/usr.sbin.mysqld || true
+ fi
+ LC_ALL=C BLOCKSIZE= df --portability /var/lib/mysql/. | 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
+ }
+ sleep 1
+ done
+ exit 1
+end script
+

0 comments on commit 673e213

Please sign in to comment.