#!/bin/sh #---------------------------------------------------------------------------- # /var/install/bin/mariadb-tools-backup - MariaDB/MySQL Server backup # # Creation: 2004-06-22 jv # Last Update: $Id$ # # Copyright (c) 2004 Jens Vehlhaber, jvehlhaber(at)buchenwald(dot)de # Copyright (c) 2012-@@YEAR@@ Holger Bruenjes, holgerbruenjes(at)gmx(dot)net # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- #include eislib . /var/install/include/eislib # --------------------------------------------------------------------------- # defaults # --------------------------------------------------------------------------- get_defaults() { # default values . /var/lib/mysql/defaults.info } # --------------------------------------------------------------------------- # check status and access of MariaDB/MySQL Database # --------------------------------------------------------------------------- check_status() { if [ ! -f ${mysql_pid_file} ] then echo mecho --error "MariaDB/MySQL Server is not running." echo exit 1 fi ${mysql_basedir}/mysqladmin status >/dev/null 2>&1 if [ "${?}" -ne 0 ] then echo mecho -n --error 'MariaDB/MySQL Server' mecho -n --std " 'root' " mecho --error 'password is required.' mecho --info 'Please set the root password.' echo exit 1 fi } # --------------------------------------------------------------------------- # select file and make backup # --------------------------------------------------------------------------- run_list() { color='' if $(grep -qE "^MENU=['\"]/var/install/bin/show-menu['\"]" /etc/config.d/setup) then color='--nocolor' fi /var/install/bin/list-files.cui -t "Select database for backup"\ -c "Database:" ${color} \ -p ${mysql_datadir} \ -o 2 -d -w \ -s "${mysql_basedir}/mysqlbackup.sh --show" \ --helpfile=/var/install/help/mariadb \ --helpname=MARIADB_MENU_BACKUP } # --------------------------------------------------------------------------- # main # --------------------------------------------------------------------------- main() { get_defaults check_status run_list exit 0 } # --------------------------------------------------------------------------- # call function main # --------------------------------------------------------------------------- main "${@}" # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------