{"id":15287704,"url":"https://github.com/hobbyquaker/mqttpc","last_synced_at":"2025-04-13T06:05:28.463Z","repository":{"id":57303758,"uuid":"61317234","full_name":"hobbyquaker/mqttpc","owner":"hobbyquaker","description":"Advanced process control via MQTT :satellite:","archived":false,"fork":false,"pushed_at":"2023-09-05T11:46:50.000Z","size":7,"stargazers_count":10,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T06:04:53.676Z","etag":null,"topics":["mqtt","process-manager","stdin","stdout"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hobbyquaker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-16T18:38:44.000Z","updated_at":"2022-08-04T22:01:21.000Z","dependencies_parsed_at":"2024-08-20T12:04:13.555Z","dependency_job_id":"a71fe815-b3fd-48ac-9ccc-5b276ded1c6d","html_url":"https://github.com/hobbyquaker/mqttpc","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"e5773bb61573395c16d16bd8ec32e5c310618406"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hobbyquaker%2Fmqttpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hobbyquaker%2Fmqttpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hobbyquaker%2Fmqttpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hobbyquaker%2Fmqttpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hobbyquaker","download_url":"https://codeload.github.com/hobbyquaker/mqttpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670437,"owners_count":21142904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mqtt","process-manager","stdin","stdout"],"created_at":"2024-09-30T15:35:27.345Z","updated_at":"2025-04-13T06:05:28.433Z","avatar_url":"https://github.com/hobbyquaker.png","language":"JavaScript","funding_links":[],"categories":["Interfaces"],"sub_categories":["Operating System"],"readme":"# mqttpc\n\n[![npm version](https://badge.fury.io/js/mqttpc.svg)](https://badge.fury.io/js/mqttpc) \n[![License][mit-badge]][mit-url]\n\n\u003e Advanced process control via MQTT :satellite:\n\nTopic structure follows [mqtt-smarthome](https://github.com/mqtt-smarthome) architecture.\n\n## Documentation\n\n### Installation\n\nNeeds Node.js and npm.\n\n````npm install -g mqttpc````\n\n### Command line options\n\n```\nUsage: mqttpc [options]\n\nOptions:\n  -v, --verbosity  possible values: \"error\", \"warn\", \"info\", \"debug\"\n                                                               [default: \"info\"]\n  -n, --name       instance name. used as mqtt client id and as prefix for\n                   connected topic                               [default: \"pc\"]\n  -u, --url        mqtt broker url. See\n                   https://github.com/mqttjs/MQTT.js#connect-using-a-url\n                                                   [default: \"mqtt://127.0.0.1\"]\n  -f, --config     config file                         [default: \"./procs.json\"]\n  -h, --help       Show help                                          \n  --version        Show version number\n                                                                     \n```\n\n### Config file\n\nThe config file contains a JSON definition of all processes you want to control via MQTT:\n\n```\n{\n  \"\u003cprocess_name\u003e\": {\n    \"path\": \"/usr/bin/example\",\n    \"args\": [\"-x\", \"-y\"],\n    ...\n  },\n  ...\n}\n\n```\n\n\n#### Availabe attributes\n\nThe only mandatory attribute for each process is \"path\", all others are optional.\n\n* path - (string) path to the process\n* args - (array[string]) arguments\n* cwd - (string) the working directory (default: the cwd of mqttpc)\n* env - (object) key-value paired environment (default: the env of mqttpc)\n* uid - (number) user id\n* gid - (number) group id\n* shell - (boolean|string) run command in a shell (default: false). See https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options\n* disableStdin - (boolean) Disable the possibility to send data through MQTT to the process stdin (default: false).\n* disableStdout - (boolean) Disable MQTT publish of the process stdout (default: false).\n* disableStderr - (boolean) Disable MQTT publish of the process stderr (default: false).\n\n### Usage example\n\nLet's say we got a backup script located in ```/usr/local/bin/my-backup.sh``` that we want to control via MQTT.\n\nCreate a config entry like this:\n```Javascript\n{\n    \"my-backup\": {\n        \"path\": \"/usr/local/bin/my-backup.sh\"\n    }\n}\n```\n...and (Re)start mqttpc. Now you can start your Backup Script by publishing on ```pc/set/my-backup/spawn``` (payload is irrelevant).\nIf you want to stop your script via MQTT you could publish ```SIGKILL``` on the topic ```pc/set/my-backup/signal```.\n\n### Topics mqttpc publishes\n\n#### pc/status/\u0026lt;process_name\u0026gt;/pid\n\nAfter process start the pid is published retained. When process ends an empty payload will be published (removing the retained message).\n\n#### pc/status/\u0026lt;process_name\u0026gt;/exit\n\nAfter process exit the exit code (or the killing signal) will be published retained.\n\n#### pc/status/\u0026lt;process_name\u0026gt;/error\n\nErrors on process spawn will be published retained on this topic. On next successful process start an empty payload will be published (removing the retained message).\n\n#### pc/status/\u0026lt;process_name\u0026gt;/stdout\n\nThe processes stdout will be published on this topic (not retained).\n\n#### pc/status/\u0026lt;process_name\u0026gt;/stderr\n\nThe processes stderr will be published on this topic (not retained).\n\n#### pc/connected\n\nMqttpc will publish ```1``` on start. Will be reset to ```0``` via last will if broker connection or mqttpc process dies.\n\n### Topics mqttpc subscribes \n\n#### pc/set/\u0026lt;process_name\u0026gt;/spawn\n\nStart the process\n\n#### pc/set/\u0026lt;process_name\u0026gt;/pipe\n\nPipe payload into stdin of the process\n\n#### pc/set/\u0026lt;process_name\u0026gt;/signal\n\nSend a signal to the process (payload should be a string containing the signal name, e.g. \"SIGHUP\")\n\n\n## License\n\nMIT (c) Sebastian Raff\n\n\n[mit-badge]: https://img.shields.io/badge/License-MIT-blue.svg?style=flat\n[mit-url]: LICENSE","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhobbyquaker%2Fmqttpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhobbyquaker%2Fmqttpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhobbyquaker%2Fmqttpc/lists"}