|
||
---|---|---|
scripts | ||
changelogs.md | ||
manifest.jps | ||
readme.md |
readme.md
MB Backup Manager Documentation
Overview
The MB Backup Manager is a comprehensive backup solution designed for managing automated backups of web applications, particularly those running on the Virtuozzo Application Platform. This tool leverages cron jobs for scheduling backups and utilizes Restic for efficient backup storage and management.
Features
- Automated Backups: Schedule daily, weekly, or custom backups using cron jobs.
- Backup Types: Supports backing up core files, media files, and databases.
- Logging: Detailed logging of backup operations for monitoring and troubleshooting.
- Backup Rotation: Automatically manages old backups to save storage space.
Installation
-
Clone the Repository: Clone the repository containing the backup manager scripts to your local machine or server. The repository can be found at: MB Backup Manager Repository
-
Install Dependencies: Ensure that
Restic
andcron
are installed on your system. You can install them using the following commands:sudo dnf install -y cronie sudo dnf install -y restic
-
Set Up Directory Structure: Create the necessary directories for logs and scripts:
mkdir -p /home/litespeed/mb-backups/logs/auto mkdir -p /home/litespeed/mb-backups/logs/manual
-
Configure Environment: Ensure that the environment variables and configuration files are set up correctly, including the Restic password stored in
/etc/restic-password
. -
Install from the Virtuozzo Marketplace: To install the MB Backup Manager from the Virtuozzo Marketplace, follow these steps:
- Log in to your Virtuozzo Application Platform dashboard.
- Navigate to the Marketplace section.
- Search for "MB Backup Manager" in the marketplace.
- Click on the application to view its details and click the Install button.
- Follow the prompts to complete the installation process.
For more detailed instructions on using the Virtuozzo Marketplace, refer to the official documentation: Virtuozzo Marketplace Documentation.
Usage
Managing Backup Schedules
The manage_backup_schedule.sh
script is used to add, update, or remove backup schedules.
-
Add or Update a Backup Schedule:
To add or update a backup schedule, run the following command:
./manage_backup_schedule.sh add '0 1 * * *' 'your_restic_password'
This example schedules a backup to run daily at 1 AM.
-
Remove a Backup Schedule:
To remove an existing backup schedule, use:
./manage_backup_schedule.sh remove
Checking Scheduled Backups
You can check the current scheduled backups using the check_sched.sh
script:
./check_sched.sh
This will log the current cron jobs related to the backup script and indicate whether automated backups are enabled.
Running Backups Manually
To run backups manually, you can execute the backup_all.sh
script directly:
bash /home/litespeed/mb-backups/backup_all.sh
Troubleshooting
-
Cron Service Issues:
- If the cron service is not running, ensure it is installed and started:
sudo systemctl start crond sudo systemctl enable crond
- To check the status of the cron service, you can run:
systemctl status crond
- If the service fails to start, check the system logs for any error messages related to cron:
journalctl -xe | grep crond
- If the cron service is not running, ensure it is installed and started:
-
Log Files:
- Check the log files located in
/home/litespeed/mb-backups/logs/auto
for any errors or issues during backup operations. - Each backup run generates a log file with a timestamp, which can help identify when issues occurred.
- Check the log files located in
-
Restic Issues:
- Ensure that Restic is installed and configured correctly. You can verify its installation by running:
restic version
- If you encounter issues with Restic, check the Restic logs for detailed error messages. You can enable verbose logging by adding the
-v
flag to your Restic commands.
- Ensure that Restic is installed and configured correctly. You can verify its installation by running:
-
Backup Failures:
- If a backup fails, check the corresponding log file for detailed error messages. The logs are typically located in
/var/log/backup_addon.log
. - Look for specific error messages that indicate what went wrong during the backup process.
- If a backup fails, check the corresponding log file for detailed error messages. The logs are typically located in
-
Cron Job Not Found:
- If the scheduled cron job is not found, ensure that the
manage_backup_schedule.sh
script was executed successfully and that the cron job was added correctly. - You can list the current cron jobs by running:
crontab -l
- If the job is missing, re-run the
manage_backup_schedule.sh
script with the correct parameters.
- If the scheduled cron job is not found, ensure that the
-
Debugging Cron Jobs:
- If your cron job is not executing as expected, you can redirect the output and error messages to a log file by modifying the cron command in the
manage_backup_schedule.sh
script. For example:CMD="RESTIC_PASSWORD=\"$3\" $BACKUP_SCRIPT > \"${BACKUP_LOG_PREFIX}\$(date +\\%Y-\\%m-\\%d_\\%H-\\%M-\\%S).log\" 2>&1"
- This will help capture any errors that occur when the cron job runs.
- If your cron job is not executing as expected, you can redirect the output and error messages to a log file by modifying the cron command in the
-
Environment Variables:
- Ensure that any environment variables required by your scripts (like
RESTIC_PASSWORD
) are set correctly. You can check the environment variables in your cron jobs by adding a command to print them to a log file:env > /home/litespeed/mb-backups/logs/cron_env.log
- Ensure that any environment variables required by your scripts (like
-
Permissions:
- Ensure that the scripts have the correct permissions to execute. You can set the executable permission using:
chmod +x /home/litespeed/mb-backups/*.sh
- Ensure that the scripts have the correct permissions to execute. You can set the executable permission using:
-
Testing Scripts Manually:
- If you suspect an issue with a specific script, try running it manually in the terminal to see if it executes without errors. This can help isolate the problem.
-
Check for Running Processes:
- If you suspect that a backup process is already running, you can check for running instances of your backup scripts using:
pgrep -f backup_all.sh
- This will show you if there are any active processes related to your backup operations.
- If you suspect that a backup process is already running, you can check for running instances of your backup scripts using:
By following these debugging tips, you can effectively troubleshoot issues related to the MB Backup Manager and ensure that your backup processes run smoothly.
Conclusion
The MB Backup Manager provides a robust solution for managing backups in a cloud environment. By following the guidelines outlined in this documentation, developers can effectively set up, manage, and troubleshoot the backup processes. For further assistance, please refer to the log files or reach out to the development team.
Repository Information
For the latest updates and commit history, you can find the repository at: MB Backup Manager Repository