-
Notifications
You must be signed in to change notification settings - Fork 1
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
13409c6
commit cb8da1a
Showing
1 changed file
with
53 additions
and
0 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,53 @@ | ||
# SvcInstall | ||
|
||
SvcInstall installs services on OSX (launchd) and Linux (inet.d start-stop-dameon) | ||
|
||
|
||
> - Small and lightweight | ||
> - Avoid coupling with any keep alive or monitoring solution. You Pick ( [SvcHost] is decoupled sister project) | ||
> - Can point a node project, a shell script, etc... Whatever you choose. | ||
> - Package installer with your app or service | ||
## Install: | ||
|
||
npm install svcinstall --save | ||
|
||
|
||
|
||
```js | ||
var path = require('path'); | ||
var si = require('svcinstall'); | ||
|
||
var scriptPath = path.join(__dirname, 'server.js'); | ||
var options = { | ||
args: ['/usr/local/bin/node', scriptPath], | ||
workingDirectory: path.dirname(scriptPath) | ||
}; | ||
|
||
var svcinstall = new sim.SvcInstall('myserver', 'com.sample'); | ||
svcinstall.install(options, function(err){ | ||
if (err) { | ||
console.error('Error:', err.message); | ||
return; | ||
} | ||
|
||
console.log('Installed Successfully'); | ||
|
||
svcinstall.start(function(err) { | ||
if (err) { | ||
console.error('Failed to start: ', err.message); | ||
return; | ||
} | ||
|
||
console.log('Started Successfully'); | ||
}); | ||
}); | ||
``` | ||
|
||
License | ||
---- | ||
|
||
Apache 2.0 | ||
|
||
[svchost]:http://github.com/bryanmacfarlane/svchost | ||
|