https://github.com/tilfin/serverbackup
Server backup to cloud
https://github.com/tilfin/serverbackup
backup crontab gsutil server-backup
Last synced: about 1 year ago
JSON representation
Server backup to cloud
- Host: GitHub
- URL: https://github.com/tilfin/serverbackup
- Owner: tilfin
- License: mit
- Created: 2015-03-28T04:03:43.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-02-12T13:58:27.000Z (over 10 years ago)
- Last Synced: 2025-02-05T14:12:27.029Z (over 1 year ago)
- Topics: backup, crontab, gsutil, server-backup
- Language: Shell
- Size: 14.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
ServerBackup
============
[](https://travis-ci.org/tilfin/serverbackup)
Server backup to cloud
It can rotate the bucket which is backup destination of each day.
Prerequisites
-------------
Any sync tool
For example,
* s3sync (easy to use https://github.com/tilfin/s3sync forked from aproxacs/s3sync)
* gsutil (https://cloud.google.com/storage/docs/gsutil)
Setup
-----
```
$ sudo -i
# mkdir -p /backup/log
# mkdir /backup/tmp
# cd /backup
# git clone --depth 1 https://github.com/tilfin/serverbackup.git
# cd serverbackup
# cp backup.conf.sample backup.conf
```
### Quick Settings for Google Cloud Storage
#### Install gsutil
```
# apt-get install python-dev python-crypto
# cd /backup
# wget https://storage.googleapis.com/pub/gsutil.tar.gz
# tar zxf gsutil.tar.gz
```
#### Setup gsutil authentication
```
# /backup/gsutil/gsutil config -o /backup/serverbackup/boto.cfg
```
The above method is that the token refresh does not work.
It is permanently set up in the following way.
1. Create a service account at your Google cloud console.
2. Select to furnish a new private key whose type is _P12_.
3. Put created .p12 file at `/backup/serverbackup/`
4. Write `/backup/serverbackup/boto.cfg` with the content of the following
```
[Credentials]
gs_service_client_id =
gs_service_key_file = /backup/serverbackup/
gs_service_key_file_password =
[Boto]
https_validate_certificates = True
[GSUtil]
content_language = en
default_api_version = 2
default_project_id =
```
#### backup.conf
Edit following entries.
* Buckets
* Sync
```
Buckets=backup-bucket
Sync=/backup/serverbackup/sync.gsutil
```
#### Backup commands
bkcmd.d behaves like _rcX.d_. Kick each script with prefix 'S' in this directory.
${BKUP_PREFIX} is combined backup directory path and file prefix which is the day number (ex _/backup/tmp/3-_).
#### Crontab
Kick backup at 3:00am
```
0 3 * * * /backup/serverbackup/backup
```
You can mail a backup result if you set MAILTO in crontab.