| 1 | #!/bin/bash
|
|---|
| 2 | #
|
|---|
| 3 | # This script is executed by "/etc/init.d/mysql" on every (re)start.
|
|---|
| 4 | #
|
|---|
| 5 | # Changes to this file will be preserved when updating the Debian package.
|
|---|
| 6 | #
|
|---|
| 7 |
|
|---|
| 8 | source /usr/share/mysql/debian-start.inc.sh
|
|---|
| 9 |
|
|---|
| 10 | MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
|
|---|
| 11 | MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
|
|---|
| 12 | MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf"
|
|---|
| 13 | MYCHECK="/usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf"
|
|---|
| 14 | MYCHECK_SUBJECT="WARNING: mysqlcheck has found corrupt tables"
|
|---|
| 15 | MYCHECK_PARAMS="--all-databases --fast --silent"
|
|---|
| 16 | MYCHECK_RCPT="root"
|
|---|
| 17 |
|
|---|
| 18 | # The following commands should be run when the server is up but in background
|
|---|
| 19 | # where they do not block the server start and in one shell instance so that
|
|---|
| 20 | # they run sequentially. They are supposed not to echo anything to stdout.
|
|---|
| 21 | # If you want to disable the check for crashed tables comment
|
|---|
| 22 | # "check_for_crashed_tables" out.
|
|---|
| 23 | # (There may be no output to stdout inside the background process!)
|
|---|
| 24 | echo "Checking for tables which need an upgrade, are corrupt or were "
|
|---|
| 25 | echo "not closed cleanly."
|
|---|
| 26 | (
|
|---|
| 27 | upgrade_system_tables_if_necessary;
|
|---|
| 28 | check_root_accounts;
|
|---|
| 29 | check_for_crashed_tables;
|
|---|
| 30 | ) >&2 &
|
|---|
| 31 |
|
|---|
| 32 | chgrp www /etc/mysql/debian.cnf
|
|---|
| 33 | chmod g+r /etc/mysql/debian.cnf
|
|---|
| 34 |
|
|---|
| 35 | exit 0
|
|---|