A simple backup shell script by bash 'v4.*'.
$ git clone git@github.com:newsdict/bash-backup.git
$ cd bash-backup
$ cp env-example .env
edit .env
file
$ bash backup.sh [--debug]
$ git clone git@github.com:newsdict/bash-backup.git
$ cd bash-backup
$ cp env-example .env-sample1
edit .env-sample1
file
$ cp env-example .env-sample2
edit .env-sample2
file
$ sh backup.sh [--debug] sample1
$ sh backup.sh [--debug] sample2
- Archive the datas. (tar.gz or tar.bz2 or zip)
- mysqldump - only mysql yet....
- Rearchive the 1 and 2 (tar.gz or tar.bz2 or zip)
- Upload to S3. (Generation management) - only s3 yet.......
temporary_directory=tmp
log_name=logs/backup.$now.log
backup_filename=backup
display_messages=1
archive=1
declare -a archive_paths=(
"/var/www/html"
"/etc/nginx"
)
commpression_type=gzip
*gzip: *.tar.gz *zip: *.zip *bzip2: *.tar.bz2
database=1
declare -A database_conf=(
["engine"]="mysql" # mysql only
["name"]="sample1_database" # database name
["username"]="user1" # username
["password"]="pass" # password
["host"]="127.0.0.1" # host
["port"]=3306 # port
)
storage_type=s3
*s3
only
declare -A s3_conf=(
["keep"]=5
["access_key"]=""
["secret"]=""
["bucket"]="backup"
["path"]="test"
["region"]="ap-northeast-1"
)