#!/bin/sh #----------------------------------------------------------------------------- # /var/install/bin/eisportal-tools-db-backup # # Creation: 03.07.2006 ys # Last Update: $Id$ # # Copyright (c) 2005-2006 Yves Schumann # # 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 . /etc/config.d/eisportal mysql_data_dir=/var/lib/mysql mysql_base_dir=/usr/local/mysql #----------------------------------------------------------------------------- # check for mysql #----------------------------------------------------------------------------- if [ ! -f /var/run/mysql.pid ] then mecho "" mecho -error "MySQL Server not running" mecho "" exit 1 fi # clear screen after mysql check clrhome #----------------------------------------------------------------------------- # create file name #----------------------------------------------------------------------------- actMonth=`date +'%m'` actDay=`date +'%d'` actYear=`date +'%Y'` actHour=`date +'%H'` actMinute=`date +'%M'` fileName="eisportal_db.${actYear}-${actMonth}-${actDay}-${actHour}-${actMinute}.sql" #----------------------------------------------------------------------------- # show some infos #----------------------------------------------------------------------------- mecho "" mecho "Creating backup of EisPortal database at this location:" mecho "" mecho "${EISPORTAL_DB_BACKUP_LOCATION}/${fileName}" mecho "" mecho -n "Please wait... " #----------------------------------------------------------------------------- # create db-dump #----------------------------------------------------------------------------- #mysql_pass=`grep passwd= ${mysql_data_dir}/backup.pwd | sed "s/passwd=//g"` #${mysql_base_dir}/bin/mysqldump -u backup -p${mysql_pass} ${EISPORTAL_DB_NAME} > ${EISPORTAL_DB_BACKUP_LOCATION}/${fileName} ${mysql_base_dir}/bin/mysqldump -h ${EISPORTAL_DB_HOST} -u ${EISPORTAL_DB_ADMIN_USER} -p${EISPORTAL_DB_ADMIN_PASS} ${EISPORTAL_DB_NAME} > ${EISPORTAL_DB_BACKUP_LOCATION}/${fileName} mecho "Done" anykey exit 0 ### --------------------------------------------------------------------------- ### End ###----------------------------------------------------------------------------