Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- join_path() {
- echo "${1:+$1/}$2" | sed 's#//#/#g'
- }
- ## Check variables
- check='true'
- [[ -z "$folder" ]] && echo "Empty Folder name" && check='false'
- [[ -z "$minio_server" ]] && echo "Empty minio server name" && check='false'
- [[ -z "$minio_path" ]] && echo "Empty minio path name" && check='false'
- [[ -z "$prefix" ]] && echo "Empty Prefix name" && check='false'
- if [ "$check" == 'false' ]; then
- echo "Please set var folder, minio_server, minio_path, prefix."
- echo "Ex: folder=a minio_server=b minio_path=c prefix=d "`basename "$0"`
- exit 1
- fi
- minio_full_path=`join_path ${minio_server} $minio_path`
- if [ -d "$folder" ]; then
- /bin/tar -zcf - $folder | /usr/local/bin/mc pipe ${minio_full_path}/${prefix}-$(date +%F).tar.gz
- else
- echo "Backup Folder not found found."
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement