Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Net Ctrl PC

Remote control of computers via MQTT Client + Server | Python 3 | Systemd | i18n


Description

Net Ctrl PC is a system for centralized management of computers in a local network using an MQTT broker.

The system consists of two components:

  • Server — receives commands from the administrator, sends them to clients, and waits for confirmations.
  • Client — runs on workstations, accepts commands, and performs corresponding actions (poweroff, reboot, custom scripts, etc.).

Full localization support is implemented using gettext.


Features

Server

  • Sends commands to clients
  • Receives status updates (received, executing, done, error)
  • Logging with rotation
  • Runs as a systemd service

Client

  • Connects to MQTT broker
  • Listens to its command topic
  • Executes actions based on configuration:
    • poweroff
    • reboot
    • running bash scripts
    • custom commands
  • Sends status back to the server
  • Fully localized (uk/en)

Installation

  1. Clone the repository
    git clone https://github.com/yourname/net-ctrl-pc.git
    cd net-ctrl-pc
  1. Install the Python package
    sudo python3 setup.py install
  1. Create service user and directories
   sudo useradd -r -s /usr/bin/nologin -d /var/lib/netctrl -c "net-ctrl-pc user" netctrl

   sudo install -d -m 750 -o netctrl -g netctrl /var/log/net-ctrl-pc
   sudo install -d -m 750 -o netctrl -g netctrl /var/lib/net-ctrl-pc
  1. Create configuration directory and copy config files
    sudo mkdir -p /etc/net-ctrl-pc  
    sudo cp configs/*.yaml /etc/net-ctrl-pc/
  1. Install systemd service files and reload daemon
    sudo cp systemd/*.service /usr/lib/systemd/system/
    sudo systemctl daemon-reload

Configuration

Examples of configuration files actions.yaml, client.yml, server.yaml, they need to be adjusted to your needs


Localization

To create or update translation templates (.pot) and translation files (.po), use the localization scripts located in:

net_ctrl_pc/data/scripts/

Running

Server

Run manually:

    python3 -m net_ctrl_pc.server

Or enable and start via systemd:

    sudo systemctl enable --now net-ctrl-pc-server

Client

Run manually:

    python3 -m net_ctrl_pc.client

Or enable and start via systemd:

    sudo systemctl enable --now net-ctrl-pc-client

MQTT Command Testing

Send a command:

    mosquitto_pub -t "net-ctrl-pc/pc001/commands" -m '{"cmd": "poweroff"}'

Expected responses:

  • received
  • executing
  • done

License

MIT License

About

Remote control of computers via MQTT

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages