A robust, secure backup solution written in V language that creates encrypted, signed, and compressed backups with real-time notifications.
๐ |
GPG Encryption & Signing - All backups are encrypted and digitally signed |
๐ฆ |
High Compression - Uses |
๐ฑ |
Real-time Notifications - Sends status updates via ntfy.sh |
โก |
Fast & Efficient - Written in V for optimal performance |
๐ก๏ธ |
Security First - Handles sensitive directories with proper permissions |
๐ |
Detailed Reporting - Comprehensive backup statistics and status |
๐ฏ |
YAML Configuration - Easy-to-manage configuration file |
The script uses a YAML configuration file (backups.yaml) with the following structure:
configs:
gpg_email: "your-email@example.com" # (1)
dest_dir: "/path/to/backup/directory" # (2)
ntfy:
topic: "your-backup-topic" # (3)
url: "https://ntfy.sh" # (4)
backups:
- title: "DUMMY" # (5)
path: "/tmp"
- title: "SSH Keys" # (6)
path: "/home/user/.ssh"
- title: "GPG Keys"
path: "/home/user/.gnupg"
- title: "Application Config"
path: "/home/user/.config/myapp"-
Email associated with your GPG key
-
Directory where encrypted backups will be stored
-
ntfy.sh topic for notifications
-
ntfy.sh server URL
-
Dummy entry - do not remove, used for array initialization
-
Actual backup entries with title and path
The script uses ntfy.sh for real-time notifications
=== ๐ BACKUP SCRIPT COM GPG ===
โ
Chave GPG encontrada
๐ Iniciando backups criptografados...
๐ฆ Processando: SSH Keys
๐ Origem: /home/user/.ssh
๐พ Arquivo temporรกrio: /home/user/vBackups/ssh_keys_2025-07-07_18-57-04.tar.gz
๐ Usando sudo para diretรณrio sensรญvel
โ
Backup criado: 2.3 KB
๐ Criptografando e assinando com GPG...
โ
Arquivo criptografado: ssh_keys_2025-07-07_18-57-04.tar.gz.gpg
๐๏ธ Removendo arquivo nรฃo criptografado...
๐ Backup final: ssh_keys_2025-07-07_18-57-04.tar.gz.gpg (3.1 KB)
=== ๐ RESUMO FINAL ===
โ
Backups bem-sucedidos: 3/3
๐ฆ Tamanho total dos backups: 15.7 MB
๐ Todos os backups foram criptografados e assinados
๐ง Chave GPG usada: your-email@example.com
๐ Todos os backups foram concluรญdos com sucesso!
๐ฑ Enviando notificaรงรฃo...graph TD
A[Start] --> B[Check Dependencies]
B --> C[Load YAML Config]
C --> D[Verify GPG Key]
D --> E[Create Destination Directory]
E --> F[Process Each Backup Item]
F --> G[Create Compressed Archive]
G --> H[Encrypt & Sign with GPG]
H --> I[Remove Unencrypted File]
I --> J[Update Statistics]
J --> K{More Items?}
K -->|Yes| F
K -->|No| L[Send Notification]
L --> M[End]
Backup files follow this naming pattern:
{slugified_title}_{timestamp}.tar.gz.gpg
Example: ssh_keys_2025-07-07_18-57-04.tar.gz.gpg
-
Encryption: All backups are encrypted using GPG with your public key
-
Digital Signing: Files are signed with your private key for authenticity
-
Secure Permissions: Sensitive directories (
.ssh,.gnupg) are handled withsudo -
Cleanup: Unencrypted temporary files are automatically removed
The script uses pigz for parallel compression. You can modify the compression command in the source code:
// Current: tar -I pigz -cf
// Alternative: tar -czf (standard gzip)
// Alternative: tar -I "xz -T0" -cf (xz compression)Add to your crontab for automated backups:
# Daily backup at 2 AM
0 2 * * * /path/to/vbackup.vsh
# Weekly backup on Sundays at 3 AM
0 3 * * 0 /path/to/vbackup.vshCreate a systemd service and timer for more advanced scheduling:
[Unit]
Description=V-Backup Service
After=network.target
[Service]
Type=oneshot
User=your-username
WorkingDirectory=/path/to/script
ExecStart=/path/to/vbackup.vsh[Unit]
Description=Run V-Backup daily
Requires=backup.service
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=timers.targetproject/ โโโ vbackup.vsh # Main backup script โโโ backups.yaml # Configuration file โโโ README.adoc # This documentation