#!/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

Related posts 相關文章
備份 VSCode 設定
More...
Linux 救援光碟 SystemRescueCd,支援Windows,也可以遠端備份還原
More...
使用 mondo 線上備份linux centos 系統
More...
linux 的 dd + nc 線上備份主機硬碟
More...

作者

留言

撰寫回覆或留言

發佈留言必須填寫的電子郵件地址不會公開。