From 1b155193f8ccff91dc62ff907f4d5e243740b7ac Mon Sep 17 00:00:00 2001 From: hhf Date: Sat, 7 Dec 2024 20:13:25 +0530 Subject: [PATCH] Update README.md --- README.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index aaf7069..c7f2701 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,58 @@ -# proxmox-snapshot-rotation +The script does the following: +1. Comprehensive Logging System: +- Dedicated log directory and rotation +- Configurable log file size limits +- Different log levels (INFO, WARN, ERROR) +- Verbose mode option +- Log rotation when size limit is reached + +2. Robust Error Handling: +- Error codes for different failure scenarios +- Detailed error messages with timestamps +- Temporary file handling for error capture +- Proper cleanup of temporary files +- Error handling for all critical operations + +3. Process Management: +- Lock file mechanism to prevent multiple instances +- Proper cleanup of lock file using trap +- Stale lock detection and cleanup + +4. Input Validation: +- Parameter validation for numeric inputs +- Better argument parsing +- Clear help message with usage examples + +5. Safety Features: +- Separate functions for snapshot creation and deletion +- Better status checking and error reporting +- Verbose logging option for debugging +- Dry-run mode improvements + +6. Code Organization: +- Modular function design +- Clear separation of concerns +- Constants and configuration at the top +- Main function to orchestrate operations +- Better variable naming and scope management + +To use the script: + +1. Save it to a location like `/usr/local/sbin/proxmox-snapshot-rotation.sh` +2. Make it executable: `chmod +x /usr/local/sbin/proxmox-snapshot-rotation.sh` +3. Create the log directory: `mkdir -p /var/log/proxmox-snapshots` + +You can run it with various options: +```bash +# Normal run +./proxmox-snapshot-rotation.sh + +# Dry run with verbose output +./proxmox-snapshot-rotation.sh --dry-run --verbose + +# Keep more snapshots and longer retention +./proxmox-snapshot-rotation.sh --keep 48 --retain-days 14 +``` + +The script will create detailed logs in `/var/log/proxmox-snapshots/` and handle various error conditions gracefully. \ No newline at end of file