Data integrity is critical for a public-facing knowledge base. This page documents the automated backup strategy implemented to prevent data loss due to system failures or accidental deletions.
A customized bash script is used to compress the DokuWiki data and configuration files. This script also handles the rotation of old backups to manage disk space.
Backup Script Path: /usr/local/bin/cloud-backup.sh
#!/bin/bash
# Configuration
BACKUP_DIR="/var/backups/dokuwiki_cloud"
SOURCE_DIR="/var/www/html/dokuwiki" # Adjust based on your actual path
DATE=$(date +%Y-%m-%d_%H-%M)
FILE_NAME="cloud_wiki_$DATE.tar.gz"
# Create directory if it doesn't exist
mkdir -p "$BACKUP_DIR"
# Create the compressed backup
tar -czf "$BACKUP_DIR/$FILE_NAME" "$SOURCE_DIR"
# Delete backups older than 14 days
find "$BACKUP_DIR" -type f -name "*.tar.gz" -mtime +14 -exec rm {} \;
To ensure the backup runs without manual intervention, a cron job is scheduled to execute the script every night at 03:00 AM.
# Open the root crontab sudo crontab -e # Add the following line 0 3 * * * /usr/local/bin/cloud-backup.sh > /dev/null 2>&1
Beyond file-level backups, the Oracle Cloud Infrastructure (OCI) is configured to perform automated snapshots of the entire boot volume.
For maximum security, the local backups can be synchronized to an off-site location (e.g., S3-compatible storage or another VPS) using rclone.
# Example command for syncing to a remote storage rclone sync /var/backups/dokuwiki_cloud remote:my-backup-bucket
โ Summary: With both file-level cron jobs and infrastructure-level volume backups, the Cloud Docs instance is fully protected against data loss.