You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
577 B
20 lines
577 B
3 years ago
|
import { execSync } from 'child_process'
|
||
|
|
||
|
// Returns one of: off, installed, enabled, running, synced, error
|
||
|
function serviceStatus() {
|
||
|
try {
|
||
|
const stdout = execSync('systemctl status ao')
|
||
|
const isServiceRunning = stdout.includes('Active: active (running)')
|
||
|
if(isServiceRunning) return 'running'
|
||
|
else if(stdout.includes('error')) return 'error'
|
||
|
else if(stdout.includes('stopped')) return 'installed'
|
||
|
} catch(err) {
|
||
|
return 'error'
|
||
|
}
|
||
|
return 'off'
|
||
|
}
|
||
|
|
||
|
export default {
|
||
|
description: 'AO server instance on this computer',
|
||
|
status: serviceStatus
|
||
|
}
|