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
549 B
20 lines
549 B
2 years ago
|
import { execSync } from 'child_process'
|
||
|
|
||
|
// Returns one of: off, installed, enabled, running, synced, error
|
||
|
export function torStatus() {
|
||
|
try {
|
||
|
const stdout = execSync('systemctl status tor')
|
||
|
const isTorRunning = stdout.includes('Active: active (running)')
|
||
|
if(isTorRunning) 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: 'connect AOs p2p',
|
||
|
status: torStatus
|
||
|
}
|