-
Notifications
You must be signed in to change notification settings - Fork 0
/
installMac.js
31 lines (26 loc) · 923 Bytes
/
installMac.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
var Service = require('node-mac').Service;
// Create a new service object
var svc = new Service({
name:'now-playing-server',
description: 'Now Playing server for Minimalistic Desktop',
script: require('path').join(__dirname, 'nowplaying.js')
});
// 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:8975 to see it in action.\n');
});
// Install the script as a service.
svc.install();