-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.mjs
executable file
·36 lines (31 loc) · 1.07 KB
/
index.mjs
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
#!/usr/bin/node --experimental-modules
import path from "path";
import EthOSConfig from "./lib/EthOSConfig";
import EthOSAgent from "./lib/EthOSAgent";
import EthOSWatch from "./lib/EthOSWatch";
import EthOSNightShiftWatch from "./lib/EthOSNightShiftWatch";
// change working dir to /home/ethos/ethos-agent
// because execute from /etc/rc.local
process.chdir( path.parse( process.argv[1] ).dir );
const config = new EthOSConfig();
const agent = new EthOSAgent(config);
const watch = new EthOSWatch(agent);
const night = new EthOSNightShiftWatch(agent);
if (config.watch_enable) {
console.log("ethos-agent watch enabled");
setTimeout(() => {
console.log("ethos-agent watch start");
watch.start();
}, 3 * 60 * 1000); // 3 min delay
} else {
console.log("ethos-agent watch disabled");
}
if (config.nightShift_enable) {
console.log("ethos-agent night shift watch enabled");
setTimeout(() => {
console.log("ethos-agent night shift watch start");
night.start();
}, 3 * 60 * 1000); // 3 min delay
} else {
console.log("ethos-agent night shift watch disabled");
}