Commit 55297cd8 authored by Aral Balkan's avatar Aral Balkan
Browse files

Status command now also shows Owncast service status

parent 8fa830ad
......@@ -33,6 +33,13 @@ function status () {
if (daemonDetails !== null) {
const textColour = isActive ? 'green' : 'red'
if (daemonDetails.owncast.isEnabled) {
const owncastActiveState = daemonDetails.owncast.isActive ? clr('active', 'green') : clr('inactive', 'red')
const owncastEnabledState = clr('enabled', 'green')
console.log(`\n ${clr('Owncast', textColour)}: ${owncastActiveState} and ${owncastEnabledState}.`)
}
if (isActive) {
console.log(`\n Stats : ${clr(daemonDetails.statisticsUrl, textColour)}`)
}
......
......@@ -21,7 +21,7 @@ function status () {
if (isWindows) {
// Daemons are not supported on Windows so we know for sure that it is
// neither active nor enabled :)
return { isActive: false, isEnabled: false }
return { isActive: false, isEnabled: false, daemonDetails: {} }
}
// Note: do not call ensure.systemctl() here as it will
......@@ -44,6 +44,27 @@ function status () {
isEnabled = false
}
let owncastIsActive
try {
childProcess.execSync('systemctl is-active owncast', {env: process.env, stdio: 'pipe'})
owncastIsActive = true
} catch (error) {
owncastIsActive = false
}
let owncastIsEnabled
try {
childProcess.execSync('systemctl is-enabled owncast', {env: process.env, stdio: 'pipe'})
owncastIsEnabled = true
} catch (error) {
owncastIsEnabled = false
}
const owncast = {
isActive: owncastIsActive,
isEnabled: owncastIsEnabled
}
let daemonDetails = null
if (isEnabled) {
// Parse the systemd unit configuration file to retrieve daemon details.
......@@ -84,7 +105,8 @@ function status () {
siteJSBinary,
statisticsUrl,
pathBeingServed,
optionalOptions
optionalOptions,
owncast
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment