Commit 12d5674f authored by Aral Balkan's avatar Aral Balkan
Browse files

Start command now also starts Owncast if necessary

parent 55297cd8
......@@ -6,6 +6,8 @@
//
//////////////////////////////////////////////////////////////////////
const fs = require('fs')
const path = require('path')
const childProcess = require('child_process')
const status = require('../lib/status')
const clr = require('../../lib/clr')
......@@ -36,6 +38,19 @@ function start () {
throwError(`Could not start Site.js server (${error}).`)
}
// Also see if we should start 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 starting Owncast service.')
try {
// Start the Owncast service.
childProcess.execSync('sudo systemctl start owncast', {env: process.env, stdio: 'pipe'})
} catch (error) {
throwError(`Could not start Owncast service (${error}).`)
}
}
console.log('\n 🎈 ❨site.js❩ Server started.\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