@mnmsys/mnmagent
v1.0.23
Published
MnM Agent - Cross-platform process manager with CLI interface. Requires administrator/root privileges for service installation.
Readme
# MnM Agent - Cross-Platform Process Manager
MnM Agent is a robust cross-platform process manager with CLI interface that works on Windows, Linux, and macOS. It provides a Unix Domain Socket (UDS) server for managing applications and processes, with automatic service installation capabilities.
Features
- Cross-Platform Support: Windows, Linux, and macOS
- Process Management: Start, stop, restart, and monitor applications
- Service Integration: Automatically installs as a system service
- CLI Interface: Easy-to-use command-line tools
- Configuration Management: Centralized configuration files
- User Management: Create and manage users for applications (Linux/macOS)
- Logging: Comprehensive logging for all managed processes
Installation
Prerequisites
Administrator/Root Privileges Required: MnM Agent automatically installs as a system service, which requires elevated privileges.
Global Installation
Linux/macOS:
sudo npm install -g @mnmsys/mnmagentWindows:
# Run PowerShell as Administrator, then:
npm install -g @mnmsys/mnmagentThis will:
- ✅ Install the package globally
- ✅ Create the
mnmCLI command - ✅ Automatically install and start the system service
- ✅ Create necessary configuration directories
- ✅ Set up proper permissions
Verification
Check if the service is running:
Linux:
sudo systemctl status mnmWindows:
sc query mnmmacOS:
sudo launchctl list | grep com.mnm.agentPlatform-Specific Service Installation
Linux (systemd)
- Creates a systemd service file at
/etc/systemd/system/mnm.service - Enables and starts the service automatically
- Requires root privileges (
sudo npm install -g mnmagent)
Windows
- Creates a Windows service using the Service Control Manager
- Starts automatically on system boot
- Requires Administrator privileges
macOS
- Creates a LaunchDaemon plist file
- Manages the service through launchctl
- Requires root privileges (
sudo npm install -g mnmagent)
Configuration
Environment Variables
Create a process.env file or set environment variables:
TENANTID=your_tenant_id
TENANTTOKEN=your_tenant_token
SOCKETPATH=/tmp/mnm_admin_socket # Unix/Linux/macOS
# SOCKETPATH=\\\\.\\pipe\\mnm_admin_socket # Windows (automatic)Configuration Files
Linux/macOS
- Primary config:
/etc/mnm/pm.cnf - App config:
/etc/mnm/app.conf - Logs:
/var/log/mnm/
Windows
- Primary config:
C:\\ProgramData\\mnm\\pm.cnf - App config:
C:\\ProgramData\\mnm\\app.conf - Logs: Windows Event Log
Usage
CLI Commands
Once installed, use the mnm command to interact with the service:
# List all managed processes
mnm list
# Start an application
mnm start <appName> <appPath> <uid> [args]
# Stop an application
mnm stop <appName>
# Restart an application
mnm restart <appName>
# View application logs
mnm logs <appName>
# Remove an application from management
mnm remove <appName>
# Add a new application to management
mnm add --appName myapp --modulePath /path/to/app --username appuser
# Initialize configuration
mnm init '{"setting": "value"}'Interactive Mode
Run mnm without arguments to enter interactive mode:
mnm
> list
> start myapp /path/to/app 1000
> logs myapp
> exitLocal Development and Testing
Testing Locally
- Clone the repository
- Install dependencies:
npm install - Build the project:
npm run build - Test locally:
npm run test:local
Development Mode
# Start in development mode with auto-reload
npm run dev
# Build the project
npm run build
# Start the built version
npm startTroubleshooting
Service Won't Start
- Check if another instance is running
- Verify socket path permissions
- Check system logs for errors
- Ensure proper user privileges
Permission Issues
- Linux/macOS: Run installation with
sudo - Windows: Run Command Prompt as Administrator
- Verify file system permissions on config directories
Socket Connection Issues
- Check if firewall is blocking the socket
- Verify socket path in configuration
- Ensure service is actually running
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test on multiple platforms
- Submit a pull request
License
MIT License - see LICENSE file for details.
