Skip to content

bexem/UUSM_Unofficial-Unraid-Script-Manager

Repository files navigation

Unofficial Unraid Scripts Manager (UUSM)

Tools for managing and synchronizing scripts with an Unraid server, supporting both User Scripts (with scheduling) and System Scripts.

⚠️ Important Warning

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.

🤖 About the Code

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.

Features

  • 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

Quick Start

# 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

Structure

.
├── 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)

Script Types

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

Configuration

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.env

Usage

Run interactively:

./sync_unraid_scripts.sh

Options:

  1. Download from Unraid (creates local backup)
  2. Upload to Unraid (creates remote backup)
  3. Process metadata locally without uploading
  4. Restore from previous backup

User Scripts Metadata

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

Backups

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.

Requirements

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)

Troubleshooting

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

Security

  • Never commit config.env
  • Use SSH keys, not passwords
  • Review scripts before uploading
  • Backups are unencrypted (use config.env for secrets)

License

Provided as-is for personal use.

About

Bidirectional sync and management tools for Unraid User Scripts and System Scripts with automatic backups, metadata handling, scheduling support, and SSH pooling

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages