{"_id":"start-stop-daemon","_rev":"34-5c92c811497c845e550b3029a69bf03c","name":"start-stop-daemon","description":"Easily transform a JS script into a start-stop-daemon script","dist-tags":{"latest":"0.1.1"},"versions":{"0.0.1":{"name":"start-stop-daemon","description":"A simple function to create native child_process.fork start-stop-daemon scripts that restart automatically when crashing","version":"0.0.1","author":{"name":"Jie Meng-Gerard","email":"contact@jie.fr"},"repository":{"type":"git","url":"git://github.com/jiem/start-stop-daemon.git"},"keywords":["daemon","supervisor","monitor","sysadmin","tools"],"main":"./index.js","engines":{"node":">= 0.5.0"},"_npmUser":{"name":"jiem","email":"contact@jie.fr"},"_id":"start-stop-daemon@0.0.1","dependencies":{},"devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.0-2","_nodeVersion":"v0.6.8","_defaultsLoaded":true,"dist":{"shasum":"20bf0c8426452529173e17906f91ea16d659098b","tarball":"https://registry.npmjs.org/start-stop-daemon/-/start-stop-daemon-0.0.1.tgz","integrity":"sha512-EigRvRf5Jf5nqxmhyTUBIQatW/XO0QoHj6OudtesqeRpGJinqcpZKTfn514IJJzbz/wtAotLyVCz1YGFmv0gLQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC7CzLiQ5t1JfPmNHAvreoIh0sMtK1tksLdVezhRuAfIAiEAgaZZ28mtFyZsFPKKFV4dBj5zMq3yLAvEmHs+3Bb9wKU="}]},"maintainers":[{"name":"jiem","email":"contact@jie.fr"}],"directories":{}},"0.0.2":{"name":"start-stop-daemon","description":"An 1-function module to easily create native child_process.fork start-stop-daemon scripts with crash monitoring","version":"0.0.2","author":{"name":"Jie Meng-Gerard","email":"contact@jie.fr"},"repository":{"type":"git","url":"git://github.com/jiem/start-stop-daemon.git"},"keywords":["daemon","supervisor","monitor","sysadmin","tools"],"main":"./index.js","engines":{"node":">= 0.5.0"},"_npmUser":{"name":"jiem","email":"contact@jie.fr"},"_id":"start-stop-daemon@0.0.2","dependencies":{},"devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.0-2","_nodeVersion":"v0.6.8","_defaultsLoaded":true,"dist":{"shasum":"dd384ee45b7712264ad2d1e5416c01c372d56473","tarball":"https://registry.npmjs.org/start-stop-daemon/-/start-stop-daemon-0.0.2.tgz","integrity":"sha512-v7Ij5OFHjorT4/F4t9W6qv3U2jH25aLEcwBx4k1xOrPUmwiXiUqyk/0PvG/x7XVmM1N6jtGJcQM4u2QXcZYylA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC7qaD37wFmqej0So8TzDBVzujWMN3XPPFpWcStlHf3AAiEAlxxD7HriwyRADmP6kEmSmLWufegutUyg/GdQc0Uo7iU="}]},"maintainers":[{"name":"jiem","email":"contact@jie.fr"}],"directories":{}},"0.0.3":{"name":"start-stop-daemon","description":"An 1-function module to easily create native child_process.fork start-stop-daemon scripts with crash monitoring","version":"0.0.3","author":{"name":"Jie Meng-Gerard","email":"contact@jie.fr"},"repository":{"type":"git","url":"git://github.com/jiem/start-stop-daemon.git"},"keywords":["daemon","supervisor","monitor","sysadmin","tools"],"main":"./index.js","engines":{"node":">= 0.5.0"},"_npmUser":{"name":"jie","email":"contact@jie.fr"},"_id":"start-stop-daemon@0.0.3","dependencies":{},"devDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.0-beta-10","_nodeVersion":"v0.6.6","_defaultsLoaded":true,"dist":{"shasum":"840c2508e300693620bdb00072b9c4f6f541e9ef","tarball":"https://registry.npmjs.org/start-stop-daemon/-/start-stop-daemon-0.0.3.tgz","integrity":"sha512-fw9IbGFjD7Fw8DoKoDnl5AlZsRwrxZWQeMs7h+t9YY45TAMGaLvZnHbi+V0/AqYOKsO+Xck8lwy4BL/XK2tjyA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH+qebpm31NDqdaQReAVgdVk1UARmGc7BnfMsxwCcz6LAiAD6bgadu+d0xbfv/Yw0rvSK7EQCQkdaRJjWWUy3sJJJA=="}]},"maintainers":[{"name":"jiem","email":"contact@jie.fr"},{"name":"jie","email":"contact@jie.fr"}],"directories":{}},"0.0.4":{"name":"start-stop-daemon","description":"An 1-function module to easily create native child_process.fork start-stop-daemon scripts with crash monitoring","version":"0.0.4","author":{"name":"Jie Meng-Gerard","email":"contact@jie.fr"},"repository":{"type":"git","url":"git://github.com/jiem/start-stop-daemon.git"},"keywords":["daemon","supervisor","monitor","sysadmin","tools"],"main":"./index.js","engines":{"node":">= 0.5.0"},"_npmUser":{"name":"jie","email":"contact@jie.fr"},"_id":"start-stop-daemon@0.0.4","dependencies":{},"devDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.0-beta-10","_nodeVersion":"v0.6.6","_defaultsLoaded":true,"dist":{"shasum":"ca2cb68cb3ea81ec28ca98bf39fe3ea36d506564","tarball":"https://registry.npmjs.org/start-stop-daemon/-/start-stop-daemon-0.0.4.tgz","integrity":"sha512-tiDEp8QCLd8spWno7bhnv+kGaKeDXF12RMOBCrfKV//7oipn/kC8z6RaaRL53ku/UicPXdHCZW3m42ySMOMoeA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD/+9BbLi0WmXNCuaC/I7XtwzO4ksN1wGBd1TVs1VA9AwIhAMdfvQvzCgGH9ZMZGvckLjUC95WU3/z4me5yivPkMVDR"}]},"maintainers":[{"name":"jiem","email":"contact@jie.fr"},{"name":"jie","email":"contact@jie.fr"}],"directories":{}},"0.0.5":{"name":"start-stop-daemon","description":"An 1-function module to easily create native child_process.fork start-stop-daemon scripts with crash monitoring","version":"0.0.5","author":{"name":"Jie Meng-Gerard","email":"contact@jie.fr"},"repository":{"type":"git","url":"git://github.com/jiem/start-stop-daemon.git"},"keywords":["daemon","supervisor","monitor","sysadmin","tools"],"main":"./index.js","engines":{"node":">= 0.5.0"},"_npmUser":{"name":"jie","email":"contact@jie.fr"},"_id":"start-stop-daemon@0.0.5","dependencies":{},"devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.6.19","_defaultsLoaded":true,"dist":{"shasum":"692761b7825eb7697eb865b30baaa1e203ef829c","tarball":"https://registry.npmjs.org/start-stop-daemon/-/start-stop-daemon-0.0.5.tgz","integrity":"sha512-Nx/XPJfBC+Eule6q7yluw7UZ4YXNUK0S/PYenO2M7QQaXnQJSsb9cKhX1CcQ2OssGWWJ2Ni9TWw3AlFYycdVtg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICcroxLGyL6ovfvvx4UPFt1JY1q+Wf0laXkgVFS91t5EAiEAq/z+T5JTQbi8jOjqYtD4vgBIXlB1O+hljF0wLpxU2yI="}]},"maintainers":[{"name":"jiem","email":"contact@jie.fr"},{"name":"jie","email":"contact@jie.fr"}],"directories":{}},"0.0.6":{"name":"start-stop-daemon","description":"An 1-function module to easily create native child_process.fork start-stop-daemon scripts with crash monitoring","version":"0.0.6","author":{"name":"Jie Meng-Gerard","email":"contact@jie.fr"},"repository":{"type":"git","url":"git://github.com/jiem/start-stop-daemon.git"},"keywords":["daemon","supervisor","monitor","sysadmin","tools"],"main":"./index.js","engines":{"node":">= 0.5.0"},"_npmUser":{"name":"jie","email":"contact@jie.fr"},"_id":"start-stop-daemon@0.0.6","dependencies":{},"devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.6.19","_defaultsLoaded":true,"dist":{"shasum":"83eabb5e8c77282bad091db38633555fb22eb5c2","tarball":"https://registry.npmjs.org/start-stop-daemon/-/start-stop-daemon-0.0.6.tgz","integrity":"sha512-PTkO50sMOrmpfNPVlOsQhHVb7KTAnZVgbtKmuhLibbm+yd/lLzOGCLbc99Hc+1LNTeXFzQ5vCfOE09f2VcGTbA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC+N0i1HyG8xLM7B+nw1WBmD7AAJEYhv4XffuMlA9bYXgIgU6QcQMMYNUoVNG4hY5mIJEytvYMuKaNBc9StmeLMAWs="}]},"maintainers":[{"name":"jiem","email":"contact@jie.fr"},{"name":"jie","email":"contact@jie.fr"}],"directories":{}},"0.1.0":{"name":"start-stop-daemon","description":"Easily transform a JS script into a start-stop-daemon script","version":"0.1.0","author":{"name":"Jie Meng-Gerard","email":"contact@jie.fr"},"repository":{"type":"git","url":"git://github.com/jiem/start-stop-daemon"},"keywords":["daemon","supervisor","monitor","sysadmin","tools"],"main":"./index.js","engines":{"node":"0.8.x"},"dependencies":{"forever":"0.10.0"},"_id":"start-stop-daemon@0.1.0","dist":{"shasum":"7c571472c32a7b18e0fdc6efa3413c3b1af73a01","tarball":"https://registry.npmjs.org/start-stop-daemon/-/start-stop-daemon-0.1.0.tgz","integrity":"sha512-yE914sW6sG13Fd88YqPrJQg8BAn4emTN7DhfbHiTEj8/4zNdbtdDhc5p9e1Ybg4KzTtjTx4JxVYPOlMvHp/Wrw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQClXr5i+MhI12eJPcUdPaqzzOvVDxzwLmnNlzNlJcMf5QIgQPDFnexfQxrtUguvyBBwyqzG6JBzUFJIT5yV5M07o90="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"jie","email":"contact@jie.fr"},"maintainers":[{"name":"jiem","email":"contact@jie.fr"},{"name":"jie","email":"contact@jie.fr"}]},"0.1.1":{"name":"start-stop-daemon","description":"Easily transform a JS script into a start-stop-daemon script","version":"0.1.1","author":{"name":"Jie Meng-Gerard","email":"contact@jie.fr"},"repository":{"type":"git","url":"git://github.com/jiem/start-stop-daemon"},"keywords":["daemon","supervisor","monitor","sysadmin","tools"],"main":"./index.js","engines":{"node":"0.8.x"},"dependencies":{"forever":"0.10.0"},"bugs":{"url":"https://github.com/jiem/start-stop-daemon/issues"},"homepage":"https://github.com/jiem/start-stop-daemon","_id":"start-stop-daemon@0.1.1","dist":{"shasum":"e12ab798cc6123657c04079cd2724f9e84da6ee2","tarball":"https://registry.npmjs.org/start-stop-daemon/-/start-stop-daemon-0.1.1.tgz","integrity":"sha512-SucbxDU54AgFUyQ2nfU08QMRYOd1rIe39TdPebM18AvD4Qpc8Bne+rIO4PYV6KnF+k7p/PXRBAOgi0qYJ1dtUA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH2s8lurvEwaJbeUacR0/rAqh16a2RjBHvi/huWTdqJRAiB3GbN9qBSaz6CCIWFH/WvlVLUMQVL4PVeG3EZyyfmiAw=="}]},"_from":"start-stop-daemon","_npmVersion":"1.4.3","_npmUser":{"name":"jie","email":"jie.meng.gerard@gmail.com"},"maintainers":[{"name":"jiem","email":"contact@jie.fr"},{"name":"jie","email":"contact@jie.fr"}]}},"readme":"# start-stop-daemon\n\nEasily transform a JS script into a start-stop-daemon script.\n\n## Installation\n\n    npm install start-stop-daemon\n\n## Usage\n\n    //file script.js    \n    startStopDaemon([options], function() {\n      //awesome code you want to daemonize\n    });\n\n* Start your script as a daemon with the command `node script.js start`\n* Stop the daemon with the command `node script.js stop`\n* Restart the daemon with the command `node script.js restart`\n* Get the status of the daemon with the command `node script.js status`\n* Run the script normally (not as a daemon) with the command `node script.js`\n    \n## Options\n\n* `outFile`: the file to log the daemon stdout. Default to `'out.log'`.\n* `errFile`: the file to log the daemon stderr. Default to `'err.log'`.\n* `max`: the max number of times the script should run. Default to `5`.\n* ...\n\nMore options documented on the [forever-monitor page][0].  \nOptions can also be passed from the command-line: `node script.js start --outFile custom.log` (more details [here][1]).\n\n## Events\n\nAvailable events: `'error'`, `'start'`, `'stop'`, `'restart'`, `'exit'`, `'stdout'`, `'stderr'` (more details [here][2]).  \nUse the `on` method to add a listener:\n\n    startStopDaemon(function() {\n      //code to daemonize\n    }).on(event, listener);  \n\n**Note:** In previous versions (<= 0.1.0), daemon's unexpected crashes were handled by the option `onCrash`.  \nThe same behavior can now be obtained by using the event `'restart'`. See the example below.\n\n\n## Example 1: `server.js`, a simple http server daemon\n\n``` js\n  var startStopDaemon = require('start-stop-daemon');\n  var http = require('http');\n\n  startStopDaemon(function() {  \n    http.createServer(function(req, res) {           \n      console.log(req.connection.remoteAddress + ' accessed ' + req.url);\n      if (req.url === '/error') \n        throw new Error('to crash server');        \n      res.end('Hello world! Thanks for accessing ' + req.url);        \n    }).listen(1095);    \n  })\n\n  .on('restart', function() {\n    //use this.stdout.write to write in the stdout log file, not console.log\n    this.stdout.write('Restarting at ' + new Date() + '\\n'); \n  });\n```\n\n* Start the server as a daemon with `node server.js start`  \n* Test the server in the browser at *http://localhost:1095*  \n* Make the server crash by going to *http://localhost:1095/error*  \n* Go back to *http://localhost:1095* to check that the server restarted correctly after the crash    \n* Get the server's status with `node server.js status`    \n* Stop the server with `node server.js stop`    \n* Check the stdout file `out.log`    \n\n## Example 2: `crasher.js`, a timer daemon that crashes every second\n\n``` js\n  var startStopDaemon = require('start-stop-daemon');\n\n  var options = {\n    outFile: 'customOutFile.log',   \n    errFile: 'customErrFile.log',\n    max: 3 //the script will run 3 times at most\n  };\n\n  startStopDaemon(options, function() {\n    var count = 0;\n    setInterval(function() {\n      console.log(++count * 200 + 'ms');\n      if (count >= 5) {\n        console.log('timer crashing after 1 second\\n');\n        throw new Error('to crash timer');                       \n      }\n    }, 200);      \n  });\n```\n\n* Start the timer as a daemon with `node crasher.js start`  \n* Wait 4 seconds then get the timer's status with `node crasher.js status` to check that the daemon correctly exited  \n* Check the log files `customOutFile.log` and `customErrFile.log`.     \n    \n## Implementation\n\nAs of version 0.1.0, daemons are handled by the [forever][3] module.\nThis refactoring makes `start-stop-daemon` much more robust than with my previous implementation.\nBackward compatibility (versions <= 0.1.0) is ensured for the options except for the events (`onStart`, `onCrash`, ...)\nwhich are now handled through an `EventEmitter` with a proper `on` method ([more here][2]).\nCommand-line options are not backward compatible since they are now merged with the forever ones ([more here][1]).\n\n\n## MIT License \n\nCopyright (c) 2012 Jie Meng-Gerard <contact@jie.fr>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n[0]: https://github.com/nodejitsu/forever-monitor#options-available-when-using-forever-in-nodejs\n[1]: https://github.com/nodejitsu/forever#using-forever-from-the-command-line\n[2]: https://github.com/nodejitsu/forever-monitor#events-available-when-using-an-instance-of-forever-in-nodejs\n[3]: https://github.com/nodejitsu/forever","maintainers":[{"name":"jiem","email":"contact@jie.fr"},{"name":"jie","email":"contact@jie.fr"}],"time":{"modified":"2022-06-26T23:51:09.662Z","created":"2012-02-01T03:01:06.703Z","0.0.1":"2012-02-01T03:01:09.320Z","0.0.2":"2012-02-03T12:30:36.477Z","0.0.3":"2012-03-10T11:47:20.817Z","0.0.4":"2012-06-11T08:31:48.620Z","0.0.5":"2012-07-03T09:32:05.410Z","0.0.6":"2012-09-10T15:00:55.268Z","0.1.0":"2012-10-17T02:55:08.164Z","0.1.1":"2015-04-01T13:06:20.176Z"},"author":{"name":"Jie Meng-Gerard","email":"contact@jie.fr"},"repository":{"type":"git","url":"git://github.com/jiem/start-stop-daemon"},"users":{"zyberspace":true,"neckro":true,"elycruz":true},"homepage":"https://github.com/jiem/start-stop-daemon","keywords":["daemon","supervisor","monitor","sysadmin","tools"],"bugs":{"url":"https://github.com/jiem/start-stop-daemon/issues"},"readmeFilename":"README.md"}