#!/bin/bash
# 2006/12/04 be authored by [email protected]
#
# Purpose:
# Increment backup and keeps the data some days.
#
# ChangeLog:
# 2007/04/17 fixed 保留備份逾一個月
# 2006/12/15 fixed bac_function path
# "source bac_function" to "source `echo ${0%/*}`/bac_function"
# fixed "if file exist and exit 0" to "if []; then else fi"
#
# Plan:
# 2007/xx/xx add sync or hard link
# 2007/xx/xx add check space dir and exclude it.
# 2007/xx/xx add scp options for Yes or No.
# 2007/xx/xx add which database can be choice.
# 2007/xx/xx add display the progress, or not.
#
#set -x
export LANG=C
if [ -f "`echo ${0%/*}`/bac_function" ]; then
source `echo ${0%/*}`/bac_function
else
source ./bac_function
fi
# Start to define bac setting.
# Define localhost.
Local() {
HOST_NAME="rtco"
HOST_BK_DIR="/etc/ /usr/local/MIDAS/ /root/ispconfig/ /home/ /var/spool/mail"
BAC_DIR="/var/bac/$HOST_NAME/"
FuncFILElocal
DB_USER="bacuser"
DB_PASS="bacuser123456"
DB_MYSQLDUMP="/usr/bin/mysqldump"
FuncDBlocal
}
# uncomment it, lets bac working.
Local
# Define remote client linux.
Client() {
HOST_IP="192.168.2.80"
HOST_NAME="wwwtst"
# You want to backup files, and keep space between every files or directories.
HOST_BK_DIR="/etc/ /usr/local/mysql/ /www/ /usr/local/MIDAS/ /usr/local/apache/ /usr/local/NPC3.1.2/ /home/"
# Use ssh login with public key and whatis the login name.
LOGIN_NAME="root"
# Where to restore backup data.
BAC_DIR="/var/bac/$HOST_NAME/"
# Use whats function.
# Backup only files and directories.
FuncFILE
# Create one account with privileges of dump database.
DB_USER="bacuser"
DB_PASS="bacuser123456"
# Assign whereis the mysqldump command.
DB_MYSQLDUMP="/usr/local/mysql/bin/mysqldump"
# Use whats function.
# Backup only database with mysql.
FuncDB
}
Client
# Define remote client windows, but first install copssh on windows and active ssh.
Windows() {
HOST_NAME="waptst"
HOST_IP="192.168.2.1"
HOST_BK_DIR="/cygdrive/d/wifly/ /cygdrive/d/Superfate_v3/"
# Stored temp dir on windows.
HOST_BAC_DIR="/cygdrive/d/bac/$HOST_NAME/"
BAC_DIR="/var/bac/$HOST_NAME/"
LOGIN_NAME="cross"
FuncWIN
}
Windows
#
WinORA() {
HOST_NAME="waptst"
HOST_IP="192.168.2.1"
HOST_BAC_DIR="/cygdrive/d/bac/$HOST_NAME/"
BAC_DIR="/var/bac/$HOST_NAME/"
LOGIN_NAME="cross"
EXE="/cygdrive/d/oracle/ora81/bin/exp.exe"
ORA_USER="wifly"
ORA_PASS="wifly123456"
ORA_NAME="mindwin"
FuncORA
}
WinORA
WinORAfull() {
HOST_NAME="waptst"
HOST_IP="192.168.2.1"
HOST_BAC_DIR="/cygdrive/d/bac/$HOST_NAME/"
BAC_DIR="/var/bac/$HOST_NAME/"
LOGIN_NAME="cross"
EXE="/cygdrive/d/oracle/ora81/bin/exp.exe"
ORA_NAME="mindwin"
ORA_USER="superfate"
ORA_PASS="superfate"
INTYPE="complete"
FuncORA
}
WinORAfull
留言