UNPKG

systemctl-cmd

Version:

Allows you to control system services using the systemctl command easily and asynchronously

8 lines (5 loc) 222 B
var exec = require("child-process-promise").exec module.exports = function run(cmd, service_name, sudo = false) { var command = `${(sudo) ? 'sudo ' : ''}systemctl ${cmd} ${service_name}`; return exec(command); }