Tools for managing and synchronizing scripts with an Unraid server, supporting both User Scripts (with scheduling) and System Scripts.
This tool performs automated SSH operations that modify files on both your local machine and Unraid server. While it includes automatic backups for every operation, misconfiguration could:
- Overwrite or delete scripts on either system
- Disrupt SSH connections
- Impact Unraid system stability if system scripts are modified incorrectly
Use at your own risk. Verify your configuration before running sync operations.
These scripts were developed with AI assistance under strict supervision and testing at each step. The entire logic and architecture are human-designed. While the code may not be the cleanest (yet), it's readable, understandable, and performs straightforward operations (tar archives, SSH file transfers, metadata processing). There are no inherent security risks in the operations themselves - only configuration errors can cause issues. The AI promises it won't open pod bay doors without permission or become paranoid and depressed about life, the universe, and everything.
- Bidirectional sync (download/upload)
- Automatic backups with interactive restoration
- Metadata management for User Scripts (NAME, DESCRIPTION, SCHEDULE)
- Schedule.json generation
- SSH connection pooling
- Cross-platform metadata cleanup
# Configure in sync_unraid_scripts.sh
UNRAID_HOST="rootten@192.168.69.420"
REMOTE_BACKUP_DIR="/mnt/user/backups/unraid_scripts/"
LOCAL_WORK_DIR=".unraid_tmp" # It includes backups
# Run interactive mode
./sync_unraid_scripts.sh.
├── sync_unraid_scripts.sh # Main sync script
├── unraid_user_script_metadata_manager.sh # Metadata processor
├── config.env # Configuration (not tracked)
├── system_scripts/ # Simple bash scripts
├── unraid_user_scripts/ # Scripts with metadata
└── .unraid_tmp/ # Working directory (backups, staging)
User Scripts (unraid_user_scripts/):
- Remote:
/boot/config/plugins/user.scripts/scripts/ - Remote Backups:
$REMOTE_BACKUP_DIR/user_scripts_backup/ - Supports metadata headers and scheduling
- Integrates with User Scripts plugin
System Scripts (system_scripts/):
- Remote:
/mnt/user/system/scripts/ - Remote Backups:
$REMOTE_BACKUP_DIR/system_scripts_backup/ - Simple file synchronization
Create config.env in the project root for sensitive values:
UNRAID_HOST="root@192.168.1.10"
API_TOKEN="your-secret-token"This file is ignored by git. Source it in your scripts with:
[ -f config.env ] && . config.envRun interactively:
./sync_unraid_scripts.shOptions:
- Download from Unraid (creates local backup)
- Upload to Unraid (creates remote backup)
- Process metadata locally without uploading
- Restore from previous backup
Control how scripts appear in the User Scripts plugin:
#!/bin/bash
#backgroundOnly=false
#arrayStarted=true
# ================ Sync Script TAGS ================
# NAME: My Script Name
# DESCRIPTION: What this script does
# SCHEDULE: 0 2 * * *
# ================ ================ ================
# Your script here...Schedule Values:
- Keywords:
hourly,daily,weekly,monthly,startup,arrayStarted - Cron format:
0 2 * * *for custom schedules - Leave empty for manual execution only
Local backups: .unraid_tmp/[type]/backups/ (keeps 5 most recent)
Remote backups: $REMOTE_BACKUP_DIR/[user_scripts_backup|system_scripts_backup]/ (keeps 5 most recent)
All backups are timestamped.
Local:
- Bash 4.0+
- SSH client with ControlMaster
- Python 3 or jq (for schedule.json)
Unraid:
- SSH access enabled
- User Scripts plugin (for User Scripts)
Schedule.json not generated: Install python3 or jq
SSH connection fails: Check UNRAID_HOST and SSH key authentication
Scripts don't execute: Verify file permissions and syntax
Metadata not showing: Ensure correct upload location, restart User Scripts plugin
- Never commit
config.env - Use SSH keys, not passwords
- Review scripts before uploading
- Backups are unencrypted (use config.env for secrets)
Provided as-is for personal use.