Get your current systemd service status
npm install systemd-status
Note: as
systemd
only available onLinux
, it can only be installed onLinux
machines.
If still wish to install it (for development reasons) use--force
You can use the systemdStatus
function to get the status of either a single or multiple services.
const systemdStatus = require('systemd-status');
const plexStatus = systemdStatus('plexmediaserver');
// {
// name: 'plexmediaserver',
// isActive: true,
// state: 'running',
// timestamp: '2020-06-02T13:21:51.716Z',
// isDisabled: false
// }
const systemdStatus = require('systemd-status');
const currentStatus = systemdStatus(['plexmediaserver', 'smbd', 'pihole-FTL']);
// [
// {
// name: 'plexmediaserver',
// isActive: true,
// state: 'running',
// timestamp: '2020-06-02T13:21:51.716Z',
// isDisabled: false
// },
// {
// name: 'smbd',
// isActive: false,
// state: 'dead',
// timestamp: null,
// isDisabled: true
// }
// {
// name: 'pihole-FTL',
// isActive: true,
// state: 'exited',
// timestamp: '2020-06-02T13:21:51.716Z',
// isDisabled: false
// }
// ]