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.
28 lines
635 B
28 lines
635 B
3 years ago
|
import { execSync } from 'child_process'
|
||
|
|
||
|
// Returns one of: off, installed, enabled, running, synced, error
|
||
|
export function nginxStatus() {
|
||
|
try {
|
||
|
const stdout = execSync('nginx -v 2>&1')
|
||
|
} catch(err) {
|
||
|
return 'off'
|
||
|
}
|
||
|
|
||
|
try {
|
||
|
const stdout = execSync('systemctl status nginx')
|
||
|
if(stdout.includes('Active: active (running)')) {
|
||
|
return 'running'
|
||
|
} else if(stdout.includes('Active: inactive (dead)')) {
|
||
|
return 'installed'
|
||
|
}
|
||
|
} catch(err) {
|
||
|
return 'installed'
|
||
|
}
|
||
|
|
||
|
return 'installed'
|
||
|
}
|
||
|
|
||
|
export default {
|
||
|
description: 'host AO publicly over the world wide web',
|
||
|
status: nginxStatus
|
||
|
}
|