The process module provides comprehensive system process management capabilities for your application. It enables spawning, monitoring, and controlling system processes with real-time output streaming and web-based administration.
This module provides:
- Process Execution: Spawn and manage system processes with custom commands and environments
- Real-time Monitoring: Live output streaming via WebSockets with process state tracking
- Web Administration: Browser-based interface for creating, monitoring, and controlling processes
- Process History: Execution tracking with PIDs, exit codes, and timing information
- Start processes with custom commands, arguments, and environment variables
- Monitor process state (running, completed, failed)
- Terminate running processes
- Track process IDs, exit codes, and execution duration
- Live terminal output via WebSocket connections (requires
websocketmodule) - Buffered output for processes that complete before connection
- Thread-safe concurrent process management
- Admin panel at
/admin/execfor process management - Create new processes with custom parameters
- View running processes and execution history
- Real-time output display with WebSocket integration
- Non-blocking process execution
- Proper resource cleanup and process termination
- Configurable output buffering
- Thread-safe operations for concurrent access
// Create a new exec service
execSvc := exec.NewService()
// Create and start a process
proc := execSvc.NewExec("echo", []string{"Hello, World!"}, "", nil)
err := proc.Start()
if err != nil {
return err
}
// Wait for completion
err = proc.Wait()Navigate to /admin/exec to:
- Create new processes with custom commands
- Monitor running processes
- View real-time output (with WebSocket support)
- Terminate processes as needed
Include the websocket module to enable live output streaming:
<!-- Process detail view with WebSocket streaming -->
{%= components.RenderExecDetail(exec, ps) %}websocket- Required for real-time output streaming
user- For access control to process managementaudit- For logging process execution events
- Restrict access to trusted users only
- Validate and sanitize process commands
- Consider running in sandboxed environments
- Monitor and audit process execution
- Implement command whitelisting if needed
- Repository: https://github.com/kyleu/projectforge/tree/main/module/process
- License: CC0 (Public Domain)
- Author: Kyle U (kyle@kyleu.com)
- WebSocket Module - Required for real-time features
- User Module - For access control integration
- Project Forge Documentation - Complete documentation