mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-17 05:04:21 +01:00
* Rename snapshot -> backup * Update mariadb/CHANGELOG.md Co-authored-by: Paulus Schoutsen <balloob@gmail.com> * Update deconz/CHANGELOG.md Co-authored-by: Paulus Schoutsen <balloob@gmail.com> * Don't update version Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
29 lines
755 B
Plaintext
Executable File
29 lines
755 B
Plaintext
Executable File
#!/usr/bin/with-contenv bashio
|
|
# ==============================================================================
|
|
# Start MariaDB client to lock tables (for backups)
|
|
# ==============================================================================
|
|
|
|
bashio::log.info "Lock tables using mariadb client..."
|
|
|
|
exec 4> >(mariadb)
|
|
MARIADB_PID=$!
|
|
|
|
echo "FLUSH TABLES WITH READ LOCK;" >&4
|
|
|
|
# Notify s6 about successful service start
|
|
echo "" >&3
|
|
|
|
bashio::log.info "MariaDB tables locked."
|
|
|
|
# Register stop
|
|
function stop_mariadb_client() {
|
|
echo "UNLOCK TABLES;" >&4
|
|
bashio::log.info "MariaDB tables unlocked."
|
|
exec 4>&-
|
|
# Successful exit, avoid wait exit status to propagate
|
|
exit 0
|
|
}
|
|
trap "stop_mariadb_client" SIGTERM SIGHUP
|
|
|
|
wait "${MARIADB_PID}"
|