-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice.js
35 lines (29 loc) · 952 Bytes
/
service.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
const Service = require('node-windows').Service;
const EventLogger = require('node-windows').EventLogger;
// Create a new service object
const svc = new Service({
name:'Weather grabber',
description: 'Grabs current weather every 15 mins from Apixu API',
script: require('path').join(__dirname, 'index.js'),
// script: 'C:\\_me\\Dev\\weather-grabber\\index.js',
wait: 2,
grow: .5,
nodeOptions: [
'--harmony',
'--max_old_space_size=4096'
]
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
svc.start();
});
svc.install();
// Listen for the "uninstall" event so we know when it's done.
// svc.on('uninstall',function(){
// console.log('Uninstall complete.');
// console.log('The service exists: ',svc.exists);
// });
// Uninstall the service.
// svc.uninstall();
const log = new EventLogger('Weather grabber');