Added readme, logging and Repo password automation
This commit is contained in:
parent
7b9a7e00f2
commit
91a6fa17a2
21
README.md
Normal file
21
README.md
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
### Automatic backup script to use with Kopia and S3 compatible object storage
|
||||||
|
## Dependencies
|
||||||
|
- S3 compatible storage optional
|
||||||
|
- bash shell
|
||||||
|
- kopia (CLI)
|
||||||
|
- an internet connection
|
||||||
|
## Installation
|
||||||
|
1. Create a file called _kopia\_environment_
|
||||||
|
2. Set the following environment variables inside the new file:
|
||||||
|
- _BUCKET\_NAME_: Name of the bucket to use in your S3 compatible storage
|
||||||
|
- _ACCESS\_KEY_: Access key for your object storage
|
||||||
|
- _SECRET\_ACCESS\_KEY_: Secret key for the object storage
|
||||||
|
- _ENDPOINT_: API endpoint for the object storage
|
||||||
|
- _DIRS_: Directories to take snapshots of, space separated
|
||||||
|
- _LOGPATH_: Directory to store log files in
|
||||||
|
- _REPO\_PASSWORD_: Password to for the kopia repository
|
||||||
|
3. Create the kopia repository:
|
||||||
|
```
|
||||||
|
source kopia_environment && kopia repository create --access-key=$ACCESS_KEY --secret-access-key=$SECRET_ACCESS_KEY --ENDPOINT=$ENDPOINT -P $REPO_PASSWORD
|
||||||
|
```
|
||||||
|
4. Setup cronjob (optional)
|
||||||
|
|
@ -2,11 +2,12 @@
|
||||||
|
|
||||||
cd `dirname ${BASH_SOURCE[0]}`
|
cd `dirname ${BASH_SOURCE[0]}`
|
||||||
source ./kopia_environment
|
source ./kopia_environment
|
||||||
kopia repository connect s3 --bucket=$BUCKET_NAME --access-key=$ACCESS_KEY --secret-access-key=$SECRET_ACCESS_KEY --endpoint=$ENDPOINT
|
LOGFILE="$LOGPATH/kopia-backup-`date +"%Y%m%d-%H:%M:%S"`"
|
||||||
|
kopia repository connect s3 --bucket=$BUCKET_NAME --access-key=$ACCESS_KEY --secret-access-key=$SECRET_ACCESS_KEY --endpoint=$ENDPOINT -p $REPO_PASSWORD > $LOGFILE 2>&1;
|
||||||
|
|
||||||
for dir in $DIRS; do
|
for dir in $DIRS; do
|
||||||
kopia snapshot create $dir;
|
kopia snapshot create $dir > $LOGFILE 2>&1;
|
||||||
done
|
done
|
||||||
|
|
||||||
unset BUCKET_NAME ACCESS_KEY SECRET_ACCESS_KEY ENDPOINT DIRS
|
unset BUCKET_NAME ACCESS_KEY SECRET_ACCESS_KEY ENDPOINT DIRS LOGPATH LOGFILE REPO_PASSWORD
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user