forked from coreybutler/node-mac
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.js
More file actions
34 lines (30 loc) · 1.04 KB
/
install.js
File metadata and controls
34 lines (30 loc) · 1.04 KB
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
var Service = require('../').Service,
svc = new Service({
name: 'Hello World',
description: 'The nodejs.org example web server.',
script: require('path').join(__dirname,'helloworld.js'),
template: '/workspace/node-linux/lib/templates/systemv/debian',
env:{
name: "NODE_ENV",
value: "production"
}
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
console.log('\nInstallation Complete\n---------------------');
svc.start();
});
// Just in case this file is run twice.
svc.on('alreadyinstalled',function(){
console.log('This service is already installed.');
console.log('Attempting to start it.');
svc.start();
});
// Listen for the "start" event and let us know when the
// process has actually started working.
svc.on('start',function(){
console.log(svc.name+' started!\nVisit http://127.0.0.1:3000 to see it in action.\n');
});
// Install the script as a service.
svc.install();