Skip to content

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

  1. Click Create Script
  2. Configure the script:
FieldDescriptionRequired
NameUnique name for the scriptYes
DescriptionWhat does the script do?No
LanguageInterpreter (see below)Yes
ModulesWhich modules the script is available forYes
Script CodeThe actual script contentYes
TimeoutMaximum execution time in secondsNo
Pre-HookScript code executed BEFORE the main scriptNo
Post-HookScript code executed AFTER the main scriptNo
NotificationNotification type on executionNo

Languages

LanguageInterpreterPlatforms
Bash/bin/bashLinux, PVE, PBS, OPNsense (FreeBSD)
PowerShellpowershell.exeWindows
Pythonpython3 (Linux) / python.exe (Windows)All (if installed)
Shell/bin/shLinux, 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:

TypeDescription
NoneNo notification (default)
EmailEmail to a configured address
RESTHTTP 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

  1. Right-click on a host → Run Script
  2. Or: Detail modal → Jobs tab → Run Script
  3. Select a script from the library
  4. Click Execute

Bulk Execution

  1. Select multiple hosts using the checkboxes
  2. Click Run Script in the bulk action bar
  3. Select the script
  4. 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 -e in 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

DATAZONE Control Documentation