-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
36 lines (30 loc) · 917 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const webservice = require('./web');
const myconsole = require('./utils/console');
const mongodb = require('./database');
process.title = 'rasphome';
process.on("SIGTERM", function(){
stop()
});
process.on("SIGINT", function(){
stop()
});
function start(){
myconsole.move(0,0);
myconsole.clear();
myconsole.setcolor(myconsole.colors.white);
webservice.start();
mongodb.start()
}
function stop(){
myconsole.clear();
mongodb.stop();
webservice.stop();
process.exit(0)
}
if(process.arch === 'arm' && process.platform === 'linux'){
start()
}else{
console.log(myconsole.colors.red + "[Erro] " + myconsole.colors.white + "Não foi possivel iniciar o Rasphome");
console.log(myconsole.colors.red + "[Erro] " + myconsole.colors.white + "Esse plataforma foi feita para ser usada somente no Raspberry PI ");
process.exit()
}