Skip to content

About

systemctl API for JavaScript

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

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.js
import { 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.rules

About

systemctl API for JavaScript

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages