My attempt of creating python daemon handler.
Go to file
2024-08-11 22:09:40 +03:00
modules Added message_bus module for module to module comms. Some changes to core_daemon and daemon_cli... 2024-08-11 22:09:40 +03:00
.gitignore POC state of core_daemon. With to example modules. 2024-08-05 22:12:43 +03:00
core_daemon.py Added message_bus module for module to module comms. Some changes to core_daemon and daemon_cli... 2024-08-11 22:09:40 +03:00
daemon_cli.py Added message_bus module for module to module comms. Some changes to core_daemon and daemon_cli... 2024-08-11 22:09:40 +03:00
hook_manager.py Added message_bus module for module to module comms. Some changes to core_daemon and daemon_cli... 2024-08-11 22:09:40 +03:00
LICENSE Initial commit 2024-08-05 22:09:26 +03:00
module_manager.py Added message_bus module for module to module comms. Some changes to core_daemon and daemon_cli... 2024-08-11 22:09:40 +03:00
README.md README - fix directory name on the structure ascii art. 2024-08-06 22:41:58 +03:00

core_daemon

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

core_daemon/
├── core_daemon.py
├── daemon_cli.py
├── modules/
│   ├── extra_commands.py
│   └── http_service.py
└── README.md

Getting Started

  1. Start the core daemon:

python3 core_daemon.py

  1. 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...
  • Create module for module to module communication...