mirror of
https://github.com/acedanger/shell.git
synced 2025-12-05 22:50:18 -08:00
feat: Enhance documentation and add porcelain mode support for improved automation in plex scripts
This commit is contained in:
@@ -4,6 +4,29 @@
|
||||
|
||||
This document provides comprehensive documentation for the enhanced `backup-plex.sh` script. This advanced backup solution includes database integrity checking with automatic repair, performance monitoring, parallel processing, intelligent notifications, and WAL file handling.
|
||||
|
||||
## Enhanced Service Management Integration
|
||||
|
||||
The backup script integrates seamlessly with the enhanced `plex.sh` service management script:
|
||||
|
||||
- **Porcelain Mode**: Uses `--porcelain` for clean, automation-friendly output
|
||||
- **Color Detection**: Automatically adapts to terminal capabilities when run interactively
|
||||
- **Error Handling**: Proper integration with the enhanced error handling in `plex.sh`
|
||||
- **Non-Interactive Operation**: Designed for automated backup scenarios
|
||||
- **Service Presence Detection**: Gracefully handles systems without Plex installed
|
||||
|
||||
Example service management calls:
|
||||
|
||||
```bash
|
||||
# Stop Plex with porcelain output for automation
|
||||
/home/acedanger/shell/plex/plex.sh --porcelain stop
|
||||
|
||||
# Start Plex after backup completion
|
||||
/home/acedanger/shell/plex/plex.sh --porcelain start
|
||||
|
||||
# View logs for troubleshooting backup issues
|
||||
/home/acedanger/shell/plex/plex.sh logs --lines 50
|
||||
```
|
||||
|
||||
## Script Overview
|
||||
|
||||
**Author:** Peter Wood <peter@peterwood.dev>
|
||||
@@ -145,11 +168,11 @@ This line defines the log file path, including the current date and time in the
|
||||
|
||||
```bash
|
||||
if systemctl is-active --quiet plexmediaserver.service; then
|
||||
/home/acedanger/shell/plex/plex.sh stop || { echo "Failed to stop plexmediaserver.service"; exit 1; }
|
||||
/home/acedanger/shell/plex/plex.sh --porcelain stop || { echo "Failed to stop plexmediaserver.service"; exit 1; }
|
||||
fi
|
||||
```
|
||||
|
||||
This block checks if the Plex Media Server service is running. If it is, the script stops the service using a custom script (`plex.sh`).
|
||||
This block checks if the Plex Media Server service is running. If it is, the script stops the service using the custom `plex.sh` script with porcelain mode enabled for automation. The `--porcelain` option ensures clean, non-interactive output suitable for backup scripts.
|
||||
|
||||
### 4. Backup Plex Database Files and Preferences
|
||||
|
||||
@@ -204,11 +227,11 @@ This command sends a notification upon completion of the backup process, indicat
|
||||
|
||||
```bash
|
||||
if systemctl is-enabled --quiet plexmediaserver.service; then
|
||||
/home/acedanger/shell/plex/plex.sh start || { echo "Failed to start plexmediaserver.service"; exit 1; }
|
||||
/home/acedanger/shell/plex/plex.sh --porcelain start || { echo "Failed to start plexmediaserver.service"; exit 1; }
|
||||
fi
|
||||
```
|
||||
|
||||
This block checks if the Plex Media Server service is enabled. If it is, the script restarts the service using a custom script (`plex.sh`).
|
||||
This block checks if the Plex Media Server service is enabled. If it is, the script restarts the service using the custom `plex.sh` script with porcelain mode for automation. The `--porcelain` option ensures clean output without ANSI escape sequences when called from the backup script.
|
||||
|
||||
### 9. Legacy Cleanup
|
||||
|
||||
|
||||
Reference in New Issue
Block a user