summaryrefslogtreecommitdiffstats
path: root/debian/additions/debian-start
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:24:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:24:44 +0000
commitbf772a107fc4511b6e3e5aafddb762ca3fa74f0b (patch)
tree8d994c2f3d8e9f01da4d334f90a20798760d9318 /debian/additions/debian-start
parentAdding upstream version 1:10.11.6. (diff)
downloadmariadb-7b4a2bd557f2d08cbffa445f3af0e354c445babd.tar.xz
mariadb-7b4a2bd557f2d08cbffa445f3af0e354c445babd.zip
Adding debian version 1:10.11.6-2.debian/1%10.11.6-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/additions/debian-start')
-rwxr-xr-xdebian/additions/debian-start50
1 files changed, 50 insertions, 0 deletions
diff --git a/debian/additions/debian-start b/debian/additions/debian-start
new file mode 100755
index 00000000..d85e4a12
--- /dev/null
+++ b/debian/additions/debian-start
@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# This script is executed by both SysV init /etc/init.d/mariadb and
+# systemd mariadb.service on every (re)start.
+#
+# Changes to this file will be preserved when updating the Debian package.
+#
+
+# shellcheck source=debian/additions/debian-start.inc.sh
+source /usr/share/mysql/debian-start.inc.sh
+
+# Read default/mysql first and then default/mariadb just like the init.d file does
+if [ -f /etc/default/mysql ]
+then
+ # shellcheck source=/dev/null
+ . /etc/default/mysql
+fi
+
+if [ -f /etc/default/mariadb ]
+then
+ # shellcheck source=/dev/null
+ . /etc/default/mariadb
+fi
+
+MARIADB="/usr/bin/mariadb --defaults-file=/etc/mysql/debian.cnf"
+MYADMIN="/usr/bin/mariadb-admin --defaults-file=/etc/mysql/debian.cnf"
+# Don't run full mariadb-upgrade on every server restart, use --version-check to do it only once
+MYUPGRADE="/usr/bin/mariadb-upgrade --defaults-extra-file=/etc/mysql/debian.cnf --version-check --silent"
+MYCHECK_SUBJECT="WARNING: mariadb-check has found corrupt tables"
+MYCHECK_RCPT="${MYCHECK_RCPT:-root}"
+
+## Checking for corrupt, not cleanly closed (only for MyISAM and Aria engines) and upgrade needing tables.
+
+# The following commands should be run when the server is up but in background
+# where they do not block the server start and in one shell instance so that
+# they run sequentially. They are supposed not to echo anything to stdout.
+# If you want to disable the check for crashed tables comment
+# "check_for_crashed_tables" out.
+# (There may be no output to stdout inside the background process!)
+
+# Need to ignore SIGHUP, as otherwise a SIGHUP can sometimes abort the upgrade
+# process in the middle.
+trap "" SIGHUP
+(
+ upgrade_system_tables_if_necessary;
+ check_root_accounts;
+ check_for_crashed_tables;
+) >&2 &
+
+exit 0