-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee29644
commit abfcaea
Showing
13 changed files
with
1,282 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
support | ||
test | ||
example | ||
docs | ||
Gruntfile.js | ||
*.sock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
(The MIT License) | ||
|
||
Copyright (c) 2013 Corey Butler <corey@coreybutler.com> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
'Software'), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
node-linux | ||
========== | ||
# node-linux | ||
|
||
Create native background daemons on Linux systems. | ||
|
||
Currently being built. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
var http = require('http'); | ||
var server = http.createServer(function (req, res) { | ||
res.writeHead(200, {'Content-Type': 'text/plain'}); | ||
res.end(JSON.stringify(process.env)); | ||
//res.end('Hello World\n'); | ||
}); | ||
|
||
server.listen(3000); | ||
console.log('Server running at http://127.0.0.1:3000/'); | ||
|
||
// Force the process to close after 15 seconds | ||
setTimeout(function(){ | ||
throw 'A test Error' | ||
//process.exit(); | ||
},25000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
var Service = require('../').Service; | ||
|
||
// Create a new service object | ||
var svc = new Service({ | ||
name:'Hello World', | ||
description: 'The nodejs.org example web server.', | ||
script: require('path').join(__dirname,'helloworld.js'), | ||
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
var Service = require('../').Service; | ||
|
||
// Create a new service object | ||
var svc = new Service({ | ||
name:'Hello World', | ||
script: require('path').join(__dirname,'helloworld.js') | ||
}); | ||
|
||
// 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(); |
Oops, something went wrong.