2014-04-27 22:50:51 +01:00
|
|
|
process.on 'uncaughtException', (e) ->
|
2015-10-13 13:17:14 -03:00
|
|
|
console.error('Got unhandled exception', e, e?.stack)
|
2014-04-27 22:50:51 +01:00
|
|
|
|
2014-07-17 16:39:31 +01:00
|
|
|
supervisor = require './supervisor-update'
|
2014-04-27 22:50:51 +01:00
|
|
|
|
2014-09-15 15:04:38 +01:00
|
|
|
# Make sure the supervisor-update has initialised before we continue, as it will handle restarting to add mounts if
|
|
|
|
# necessary.
|
2014-07-17 16:39:31 +01:00
|
|
|
supervisor.initialised.then ->
|
2014-10-01 17:14:37 +01:00
|
|
|
# Start the update checks ASAP, as any later point may fail,
|
|
|
|
# but at least if we're checking for updates we may be able to update to make them work!
|
|
|
|
console.log('Starting periodic check for supervisor updates..')
|
|
|
|
setInterval(->
|
|
|
|
supervisor.update()
|
|
|
|
, 5 * 60 * 1000) # Every 5 mins
|
|
|
|
supervisor.update()
|
|
|
|
|
2014-07-17 16:39:31 +01:00
|
|
|
knex = require './db'
|
|
|
|
|
|
|
|
# Wait for the DB schema to be created
|
|
|
|
knex.init.then ->
|
|
|
|
require('./app')
|