SO
sonnyp/systemctl.js
systemctl API for JavaScript
systemctl.js
sysetmctl API for JavaScript. This is implemented using the systemd D-Bus interface so it's stable, faster and safer than spawning systemctl CLI.
Usage
npm install systemctl.jsimport { Systemctl } from "systemctl.js";
const systemctl = new Systemctl()
await systemctl.init()
await systemctl.start('sshd')
await systemctl.stop('sshd')
await systemctl.disable(['sshd'])
await systemctl.enable(['sshd'])
await systemctl.reload()If your app is not running as root (and it should not), you will encounter an authentication error. You can use polkit to allow access to the necessary systemd permissions.
# ⚠️ unsafe; this is just an example!
cp node_modules/systemctl.js/polkit.js /etc/polkit-1/rules.d/re.sonny.systemctl.rulesOn this page
Languages
JavaScript91.8%Makefile8.2%
Contributors
ISC License
Created December 18, 2025
Updated December 18, 2025