@nodevisor/services
v0.0.83
Published
Module provides ability to manage services
Readme
@nodevisor/services
Manage systemd services — start, stop, restart, and check status.
Part of Nodevisor — TypeScript Infrastructure Automation Platform
Install
npm install @nodevisor/servicesQuick Start
import $ from '@nodevisor/shell';
import Services from '@nodevisor/services';
const svc = $(Services);
// Restart a service
await svc.restart('nginx');
// Check if a service is running
if (await svc.isRunning('docker')) {
console.log('Docker is running');
}
// Get service status
const status = await svc.status('sshd');
console.log(status);Remote Usage
const $server = $.connect({ host: '10.0.0.10', username: 'root' });
await $server(Services).restart('nginx');API
| Method | Description |
|--------|-------------|
| start(name) | Start a systemd service |
| stop(name) | Stop a systemd service |
| restart(name) | Restart a systemd service |
| isRunning(name) | Check if a service is currently active |
| status(name) | Get the full status output |
Related Packages
@nodevisor/ssh— Uses Services internally to manage sshd@nodevisor/docker— Uses Services internally to manage dockerd@nodevisor/ufw— Firewall service management
Documentation
Full documentation available at nodevisor.com/docs/packages/services
License
Nodevisor uses a single O'Saasy license across all packages and applications. See the full terms in LICENSE.
