--- /etc/init/mysql.conf.ori 2013-08-09 09:44:12.000000000 +0200 +++ /etc/init/mysql.conf 2013-08-09 10:40:52.000000000 +0200 @@ -12,10 +12,21 @@ 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 + ## Fetch a particular option from mysql's invocation. + # + # Usage: void mysqld_get_param option + mysqld_get_param() { + /usr/sbin/mysqld --print-defaults \ + | tr " " "\n" \ + | grep -- "--$1" \ + | tail -n 1 \ + | cut -d= -f2 + } + + # The default of 5 seconds is too low for mysql which needs to flush buffers # priority can be overriden and "-s" adds output to stderr ERR_LOGGER="logger -p daemon.err -t /etc/init/mysql.conf -i" @@ -26,7 +37,8 @@ /lib/init/apparmor-profile-load usr.sbin.mysqld # check for diskspace shortage datadir=`mysqld_get_param datadir` - if LC_ALL=C BLOCKSIZE= df --portability $datadir/. | tail -n 1 | awk '{ exit ($4<4096) }'; then + LC_ALL=C BLOCKSIZE=`df --portability $datadir/. | tail -n 1 | awk '{ print $4 }'` + if [ $BLOCKSIZE -lt 4096 ]; then echo "$0: ERROR: The partition with $datadir is too full!" >&2 echo "ERROR: The partition with $datadir is too full!" | $ERR_LOGGER exit 1