https://github.com/drhdev/s3cmdbackup
s3cmdbackup.sh is a customizable shell script for backing up files from an Ubuntu server to DigitalOcean Spaces using s3cmd, featuring detailed logging, flexible configurations and error resilience.
https://github.com/drhdev/s3cmdbackup
backup copy digitalocean digitalocean-community-tools digitalocean-droplets digitalocean-spaces linux s3cmd s3cmd-backup shell-script shellscript sync ubuntu ubuntu-server
Last synced: about 2 months ago
JSON representation
s3cmdbackup.sh is a customizable shell script for backing up files from an Ubuntu server to DigitalOcean Spaces using s3cmd, featuring detailed logging, flexible configurations and error resilience.
- Host: GitHub
- URL: https://github.com/drhdev/s3cmdbackup
- Owner: drhdev
- License: gpl-3.0
- Created: 2024-03-19T22:07:47.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-21T22:11:05.000Z (about 1 year ago)
- Last Synced: 2025-02-01T23:27:08.613Z (4 months ago)
- Topics: backup, copy, digitalocean, digitalocean-community-tools, digitalocean-droplets, digitalocean-spaces, linux, s3cmd, s3cmd-backup, shell-script, shellscript, sync, ubuntu, ubuntu-server
- Language: Shell
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# s3cmdbackup
`s3cmdbackup.sh` is a robust and highly customizable shell script designed for backing up files from an Ubuntu server to DigitalOcean Spaces using the s3cmd tool. It ensures secure and efficient backups with detailed logging, flexible configuration options, error resilience, and supports updated backup modes "sync" and "sync and delete".
## Features
- **Flexible Configuration**: Customize hostname, DigitalOcean Spaces details, directories for backup, and more directly within the script.
- **Secure Transfer**: Supports HTTPS for secure file transfers to DigitalOcean Spaces.
- **Updated Backup Modes**: Now exclusively supports 'sync' for straightforward backups and 'sync and delete' for mirror-like backups, removing files in the destination not present in the source.
- **Logging and Monitoring**: Generates detailed logs with automatic rotation and backup messages, offering summaries of each backup operation.
- **Error Handling**: Crafted to handle errors gracefully and continue running, enhancing the script's robustness.
- **Cron Job Friendly**: Easily schedule automated backups with cron for regular, hands-off operation.## Prerequisites
- Ubuntu server (22.04 recommended)
- s3cmd version 2.x installed and configured for your DigitalOcean Spaces
- DigitalOcean Spaces access key and secret key
- `.s3cfg` configuration file set up in the user's home directory## Installation
1. Clone the repository or download `s3cmdbackup.sh` directly:
```
git clone https://github.com/drhdev/s3cmdbackup.git
```
2. Make the script executable:
```
chmod +x s3cmdbackup/s3cmdbackup.sh
```
3. Edit `s3cmdbackup.sh` to configure your backup settings, following the instructions within the script.## Usage
- **Manual Execution**:
```
./s3cmdbackup/s3cmdbackup.sh
```
- **Cron Job**: Schedule with cron for regular backups. For example, to run the backup daily at 2 AM, add the following line to your crontab (edit with `crontab -e`):
```
0 2 * * * /path/to/s3cmdbackup/s3cmdbackup.sh
```## Configuration
The script offers several configuration options for customization:
- Hostname
- DigitalOcean Spaces Details
- Backup Directory
- HTTPS Usage
- Backup Type (`sync` or `sync and delete`)
- Paths to Backup
- Logging and Backup Message SettingsRefer to comments in `s3cmdbackup.sh` for detailed configuration instructions.
## Contributing
Contributions are welcome! If you have a feature request, bug report, or suggestion, please feel free to open an issue or submit a pull request.
## License
This project is licensed under the GNU Public License - see the LICENSE file for details.