How Batch Script Automation Works in webMAN MOD: boot_init.txt and onxmb.bat Explained

WebMAN MOD executes custom batch scripts at three distinct lifecycle events—plugin load, service startup, and XMB entry—using an internal command engine that parses .bat files without invoking an external shell.

webMAN MOD includes a lightweight batch script automation system that allows users to automate tasks on a PlayStation 3 without modifying the plugin's source code. The system recognizes three special script files that trigger at deterministic moments in the plugin's lifecycle, enabling everything from cold-boot configuration to post-game cleanup.

The Three Automation Triggers

The batch script engine monitors for three specific events, each associated with a hardcoded file path defined in include/init/paths.h and documented in the bundled help.html file.

Plugin Load: boot_init.txt

When the webMAN MOD PRX is first injected into memory, the engine checks for /dev_hdd0/boot_init.txt. If present, the script executes immediately before any network services (FTP, HTTP, netiso) are initialized.

This trigger is ideal for one-time configuration tasks such as mounting SMB shares, setting environment variables, or creating symbolic links. The constant BOOT_INIT_TXT in include/init/paths.h【L220】 defines this default location.

Services Started: autoexec.bat

After webMAN MOD has successfully started its background services—FTP server, HTTP interface, and netiso support—the engine looks for /dev_hdd0/autoexec.bat. This script runs exactly once per plugin initialization, making it suitable for launching custom daemons, copying fresh configuration files, or starting homebrew applications that depend on network services.

XMB Loaded: onxmb.bat

Every time the XMB (PlayStation 3 system menu) appears, the engine executes /dev_hdd0/onxmb.bat. This includes cold boots, returning from a game, or manually invoking the XMB. According to the source code in main.c, this check occurs within the main event loop that watches for XMB_LOADED events.

This trigger is perfect for maintenance tasks that must occur after gameplay ends, such as cleaning temporary caches or remounting drives.

The Batch Script Engine Architecture

Unlike traditional batch processing that shells out to an external interpreter, webMAN MOD implements an internal command parser that reads scripts line-by-line and maps commands directly to internal C functions. This design prevents security risks by restricting operations to the WebMAN-MOD command set.

The parser supports conditional logic (if/else if/else/end if), existence checks (if exist <path>), and hardware detection (if cobra, if mamba, if ps3hen). File-system operations—including copy, fcopy, del, md, map, and unmap—execute via cellFs* system calls. Flow control commands like goto, label, while, break, and continue manage execution paths.

Command implementations reside in the include/cmd/ directory (specifically files like refresh.h and related .c modules), where each recognized token maps to a specific internal function.

Practical Code Examples

Cold-Boot Configuration with boot_init.txt

Use this script to mount an SMB share automatically when the plugin loads:


# boot_init.txt

if not exist /dev_hdd0/tmp/smb_mounted
{
    map //smb_server/share /dev_hdd0/tmp/smb_mounted
    echo "SMB share mounted" > /dev_hdd0/tmp/smb_mounted.log
}

The map command creates a virtual mount point, and the conditional ensures the operation runs only once per cold boot.

Post-Service Initialization with autoexec.bat

Guarantee a fresh configuration file after services start:


# autoexec.bat

del /dev_hdd0/tmp/wm_config.bin
copy /dev_hdd0/backup/wm_config.bin /dev_hdd0/tmp/wm_config.bin
echo "Config reloaded" > /dev_hdd0/tmp/reload.log

This executes after the FTP and HTTP servers are alive, ensuring the configuration is refreshed before any network interactions.

XMB Event Handling with onxmb.bat

Clean temporary folders every time you return to the XMB:


# onxmb.bat

del /dev_hdd0/tmp/wmtmp/*
md /dev_hdd0/tmp/wmtmp/cover_cache
echo "Temp folders cleared at $(date)" > /dev_hdd0/tmp/clean.log

This script triggers after exiting any game, maintaining disk space automatically.

Conditional Logic and Firmware Checks

Adapt behavior based on firmware version:


# onxmb.bat

if firmware >= 4.82
{
    copy /dev_hdd0/modern_plugin.sprx /dev_hdd0/boot_plugins.txt
}
else
{
    copy /dev_hdd0/legacy_plugin.sprx /dev_hdd0/boot_plugins.txt
}

The engine evaluates firmware comparisons at runtime, allowing scripts to handle different PS3 system software versions.

Source Code Implementation Details

The automation system is implemented across several key files in the aldostools/webman-mod repository:

The pseudocode execution flow in main.c follows this pattern: check for BOOT_INIT_TXT on load, start services, check for AUTOEXEC_BAT, then enter a loop that monitors for XMB_LOADED events to trigger ONXMB_BAT.

Summary

  • webMAN MOD provides three automation hooks: boot_init.txt (plugin load), autoexec.bat (services started), and onxmb.bat (XMB entry).
  • The internal command engine parses scripts directly without external shell invocation, using implementations in include/cmd/*.h and .c files.
  • Supported commands include conditionals, file operations (copy, del, map), and flow control (goto, while), documented in the bundled help.html.
  • File paths are defined as constants in include/init/paths.h, defaulting to /dev_hdd0/ for all three script types.
  • Security is maintained by restricting operations to the WebMAN-MOD command set, preventing arbitrary system execution.

Frequently Asked Questions

What commands are supported in webMAN MOD batch scripts?

The engine supports conditional statements (if, else if, else, end if), file operations (copy, fcopy, del, md, map, unmap), flow control (goto, label, while, break, continue), and hardware checks (if cobra, if mamba, if ps3hen, if firmware). The complete reference is available in the help.html file bundled with the plugin.

Can I use standard Windows batch syntax in these files?

No, webMAN MOD uses a proprietary command syntax that resembles Windows batch files but is parsed by an internal engine. Commands map directly to C functions in the include/cmd/ modules rather than being passed to an external shell interpreter, which limits syntax to the specific command set documented in the help files.

Where are the script files stored on the PS3?

By default, all three automation scripts reside in /dev_hdd0/: boot_init.txt for plugin initialization, autoexec.bat for post-service tasks, and onxmb.bat for XMB events. These paths are defined as constants in include/init/paths.h and can be referenced using the repository's source code.

How does the onxmb.bat script know when to execute?

The script triggers every time the XMB (system menu) becomes visible, including after cold boots and when returning from games. The main execution loop in main.c monitors for XMB_LOADED events and checks for the existence of onxmb.bat before running the internal batch parser.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →