systemctl-cmd
Version:
Allows you to control system services using the systemctl command easily and asynchronously
44 lines (31 loc) • 1.1 kB
Markdown
This simple node module allows you to control system services using the systemctl command easily and asynchronously.
This is a fork of VolantisDev's systemctl, because he isn't accepting pull requests.
- Archlinux or another OS which uses the systemctl command
There are two ways to use systemctl depending on your needs:
```
// For ES6:
import systemctl from 'systemctl-cmd'
// For ES5:
var systemctl = require('systemctl-cmd')
// Start a service
systemctl.start('service-name').then(output => console.log)
// Start a service with sudo
systemctl.start('service-name', true).then(output => console.log)
// Check if a service is enabled
systemctl.isEnabled('service-name').then(enabled => {
console.log((enabled ? 'Enabled' : 'Not enabled'));
})
```
```
// For ES6:
import systemctl from 'systemctl/run'
// For ES5:
var systemctl = require('systemctl/run')
// Start a service
systemctl('start', 'service-name').then(output => console.log)
```