Scripts
The script management feature allows you to centrally create, manage, and execute scripts on managed hosts. Scripts can be run individually or as a bulk action on multiple hosts.
Script Library
Access the script library via the Scripts navigation item. All available scripts are displayed here.
Creating a Script
- Click Create Script
- Configure the script:
| Field | Description | Required |
|---|---|---|
| Name | Unique name for the script | Yes |
| Description | What does the script do? | No |
| Language | Interpreter (see below) | Yes |
| Modules | Which modules the script is available for | Yes |
| Script Code | The actual script content | Yes |
| Timeout | Maximum execution time in seconds | No |
| Pre-Hook | Script code executed BEFORE the main script | No |
| Post-Hook | Script code executed AFTER the main script | No |
| Notification | Notification type on execution | No |
Languages
| Language | Interpreter | Platforms |
|---|---|---|
| Bash | /bin/bash | Linux, PVE, PBS, OPNsense (FreeBSD) |
| PowerShell | powershell.exe | Windows |
| Python | python3 (Linux) / python.exe (Windows) | All (if installed) |
| Shell | /bin/sh | Linux, FreeBSD |
Module Assignment
A script can be assigned to one or more modules:
- All - Available in all modules
- OPNsense - Bash/Shell scripts for FreeBSD
- Proxmox VE - Bash scripts for Debian
- Proxmox Backup Server - Bash scripts for Debian
- Linux - Bash scripts for all distributions
- Windows - PowerShell scripts
Timeout
Each script can have an individual timeout:
- Default: 5 minutes (300 seconds) if no timeout is specified
- If the timeout is exceeded, the script process is terminated
- For long-running operations, a higher value can be set
Pre-Hook / Post-Hook
Hooks are additional script blocks that are executed before or after the main script:
Pre-Hook (before the script):
- Typical: Stop services, create backup, enable maintenance mode
- Executed in the same language as the main script
Post-Hook (after the script):
- Typical: Start services, cleanup tasks, notifications
- Also executed when the main script fails
Notifications
After script execution, a notification can be sent:
| Type | Description |
|---|---|
| None | No notification (default) |
| Email to a configured address | |
| REST | HTTP request to a URL (webhook) |
For type Email, enter the recipient address; for REST, enter the webhook URL.
Script Editor
The integrated script editor provides:
- Syntax highlighting for Bash, PowerShell, and Python
- Line numbering
- Tab indentation
- Scroll synchronization
Executing Scripts
Single Execution
- Right-click on a host → Run Script
- Or: Detail modal → Jobs tab → Run Script
- Select a script from the library
- Click Execute
Bulk Execution
- Select multiple hosts using the checkboxes
- Click Run Script in the bulk action bar
- Select the script
- Confirm the execution
The script is started in parallel on all selected hosts.
Results
Single Result
After execution, the result is displayed:
- Exit code (0 = success, >0 = error)
- Stdout - Standard output
- Stderr - Error output
- Execution duration
- Timestamp
Execution History
Under Scripts > History tab, you can find all previous script executions with:
- Host, script name, timestamp
- Exit code and status
- Output for reference
Versioning
Scripts are automatically versioned:
- Each change creates a new version with an optional change description
- Older versions are preserved
- The current version is used when executing
System Scripts
DATAZONE Control includes predefined system scripts for common tasks:
- Update scripts (per module and OS)
- Reboot scripts
- Service checks
- Information gathering
- Agent update scripts
System scripts are marked with a lock icon and cannot be edited or deleted. They serve as templates and references for your own scripts.
Best Practices
Recommendations
- Error handling: Use
set -ein Bash scripts for immediate termination on errors - Logging: Output meaningful messages to stdout
- Idempotency: Scripts should be safe to run multiple times without side effects
- Timeouts: Set appropriate timeouts for long-running scripts
- Pre-/Post-Hooks: Use hooks for preparation/cleanup instead of putting everything in one script