core_daemon/README.md

69 lines
1.6 KiB
Markdown
Raw Normal View History

2024-08-05 22:09:26 +03:00
# core_daemon
2024-08-05 22:28:02 +03:00
My attempt of creating python daemon handler.
This was written with Python 3.11
## Features
- Core daemon that runs continuously and manages modules
- Interactive shell for user interaction
- Dynamic loading and unloading of modules
- Custom command execution from loaded modules
- Auto-completion for commands in the shell
- Ability to upgrade the core daemon
- Modules are loaded from an 'modules' directory
## Structure
2024-08-05 22:29:41 +03:00
```
core_daemon/
2024-08-05 22:28:02 +03:00
├── core_daemon.py
├── daemon_cli.py
├── modules/
│ ├── extra_commands.py
│ └── http_service.py
└── README.md
2024-08-05 22:29:41 +03:00
```
2024-08-05 22:28:02 +03:00
## Getting Started
1. Start the core daemon:
python3 core_daemon.py
2. In a separate terminal, start the shell:
python3 shell.py
## Usage
Once in the shell, you can use the following commands:
- `list_available`: List all available modules in the 'modules' directory
- `load <module_name>`: Load a module
- `unload <module_name>`: Unload a module
- `list`: List all currently loaded modules
- `upgrade`: Upgrade the core daemon (restarts the daemon in current implementation)
- Any custom commands provided by loaded modules
Use tab completion to see available commands and modules.
## Creating New Modules
To create a new module:
1. Create a new Python file in the 'modules' directory
2. Define your module as a class
3. Implement at least one of these functions `initialize()`, `shutdown()`, `get_commands()`
See `modules/extra_commands.py` and `modules/http_service.py` for an example of how to structure a module.
# Todo
- Create module to add auth for the cli connections...
2024-08-06 22:40:10 +03:00
- Create module for module to module communication...
2024-08-05 22:28:02 +03:00