Commit e7589f9b authored by Aral Balkan's avatar Aral Balkan
Browse files

Stop command now also stops Owncast if necessary

parent 12d5674f
......@@ -6,8 +6,9 @@
//
//////////////////////////////////////////////////////////////////////
const fs = require('fs')
const path = require('path')
const childProcess = require('child_process')
const status = require('../lib/status')
const clr = require('../../lib/clr')
......@@ -32,6 +33,19 @@ function stop () {
throwError(`Could not stop Site.js server (${error}).`)
}
// Also see if we should stop the Owncast service.
const systemdServicesDirectory = path.join('/', 'etc', 'systemd', 'system')
const owncastServiceFilePath = path.join(systemdServicesDirectory, 'owncast.service')
if (fs.existsSync(owncastServiceFilePath)) {
console.log(' 💮️ ❨site.js❩ Also stopping Owncast service.')
try {
// Start the Owncast service.
childProcess.execSync('sudo systemctl stop owncast', {env: process.env, stdio: 'pipe'})
} catch (error) {
throwError(`Could not stop Owncast service (${error}).`)
}
}
console.log('\n 🎈 ❨site.js❩ Server stopped.\n')
}
......
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