wpamapsta : db dump script

This commit is contained in:
Gitouche 2023-12-09 22:31:26 +01:00
parent 4221ba56ab
commit b80c5f23d9
2 changed files with 20 additions and 0 deletions

View file

@ -37,6 +37,13 @@ ensure_pwd_is_scriptdir () {
fi
}
# ok if current user is the same (name) as script directory
ensure_scriptdir_equals_user () {
if [[ "$USER" != "${ABSDIR##*/}" ]]; then
exit 1
fi
}
# make sure systemd directory exists
ensure_systemd_as_user_dir_exists () {
[[ -d ${HOME}/.config/systemd/user/ ]] || mkdir -p ${HOME}/.config/systemd/user/

13
podman-wpamapsta/60_db_dump.sh Executable file
View file

@ -0,0 +1,13 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
ensure_not_root
ensure_scriptdir_equals_user
# pod should exist
ensure_pod_exists "${pod_name}"
podman exec db /bin/bash -c '/usr/bin/mysqldump --user=${MARIADB_USER} --password=${MARIADB_PASSWORD} --all-databases'