Skip to content

andres885/secure-bak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Secure Backup

secure_cp is a lightweight Bash script for creating structured backups of virtual servers or development environments.
It automatically generates sequential backup directories (e.g., DocumentRoot.001, DocumentRoot.002, …), excludes specified directories, and preserves previous backups to maintain a clear version history.

Script output example


🚀 Features

  • Automatically numbered backup directories to prevent overwriting existing backups.
  • Exclusion rules to skip redundant or heavy data (images, videos, etc.).
  • Fully customizable — define excluded directories and files as needed.
  • Simple and fast, ideal for local or remote server backup routines.

🧰 Usage

1. Download the script

Save the secure_cp file to your preferred location and make it executable:

chmod +x secure_cp

2. Configure paths

Edit the script and modify these lines to match your environment:

ORIGEN="/var/www/DocumentRoot"
DESTINO_BASE="/home/usuario/Desarrollo/Web/Example/bkp"
NOMBRE_BASE="DocumentRoot"
  • ORIGEN → path to your source directory (e.g., your web root).
  • DESTINO_BASE → directory where backups will be stored.
  • NOMBRE_BASE → base name used for the backup directories.

3. Edit excluded directories (optional)

Modify the --exclude parameters inside the script to ignore specific folders or files:

--exclude='public_html/img' \
--exclude='vendor' \
--exclude='public_html/videos'

Add or remove exclusions to avoid copying redundant, heavy, or dynamically generated data.

4. Run the script

Execute from the terminal:

./secure_cp

A new backup directory will be created, e.g.:

/home/usuario/Desarrollo/Web/Example/bkp/DocumentRoot.001

Each subsequent execution increments the backup index automatically (DocumentRoot.002, DocumentRoot.003, …).


🧰 Example

If your document root is /var/www/html and you want backups in /mnt/backups/html:

ORIGEN="/var/www/html"
DESTINO_BASE="/mnt/backups/html"
NOMBRE_BASE="html"

Then run:

./secure_cp

🧾 License

This project is licensed under the MIT License.
See the full license here: https://opensource.org/licenses/MIT


🧑‍💻 Author

Developed by X Software
Linux software development, web solutions, and system automation.

About

Bash script for automated, incremental server backups with directory exclusion and version history.

Topics

Resources

License

Stars

Watchers

Forks

Languages