~ubuntu-branches/ubuntu/vivid/mysql-5.5/vivid

« back to all changes in this revision

Viewing changes to debian/mysql-server-5.5.mysql.upstart

  • Committer: Package Import Robot
  • Author(s): Dave Chiluk, Eduardo Damato
  • Date: 2013-11-18 09:38:46 UTC
  • Revision ID: package-import@ubuntu.com-20131118093846-2dw69sgr3kapxpq1
Tags: 5.5.34-0ubuntu2
[ Eduardo Damato ]
Fix upstart script to account for datadir disk shortage (LP: #1121874).

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
kill timeout 300
17
17
 
18
18
pre-start script
 
19
    ## Fetch a particular option from mysql's invocation.
 
20
    # Usage: void mysqld_get_param option
 
21
    mysqld_get_param() {
 
22
      /usr/sbin/mysqld --print-defaults \
 
23
        | tr " " "\n" \
 
24
        | grep -- "--$1" \
 
25
        | tail -n 1 \
 
26
        | cut -d= -f2
 
27
    }
 
28
 
 
29
    # priority can be overriden and "-s" adds output to stderr
 
30
    ERR_LOGGER="logger -p daemon.err -t /etc/init/mysql.conf -i"
 
31
 
19
32
    #Sanity checks
20
33
    [ -r $HOME/my.cnf ]
21
34
    [ -d /var/run/mysqld ] || install -m 755 -o mysql -g root -d /var/run/mysqld
22
35
    /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) }'
 
36
 
 
37
    # check for diskspace shortage
 
38
    datadir=`mysqld_get_param datadir`
 
39
    BLOCKSIZE=`LC_ALL=C df --portability $datadir/. | tail -n 1 | awk '{print $4}'`
 
40
    if [ $BLOCKSIZE -le 4096 ] ; then
 
41
      echo "$0: ERROR: The partition with $datadir is too full!" >&2
 
42
      echo "ERROR: The partition with $datadir is too full!" | $ERR_LOGGER
 
43
      exit 1
 
44
    fi
24
45
end script
25
46
 
26
47
exec /usr/sbin/mysqld