{"_id":"daemonize2","_rev":"23-5548e0900917959c5dc56214f55050cf","name":"daemonize2","description":"Module for easy creation of daemons for Node 0.8.x","dist-tags":{"latest":"0.4.2"},"versions":{"0.4.0-rc.1":{"name":"daemonize2","version":"0.4.0-rc.1","description":"Module for easy creation of daemons for Node 0.8.x","author":{"name":"Kuba Niegowski"},"contributors":[],"homepage":"https://github.com/niegowski/node-daemonize2/","keywords":["daemon"],"engines":{"node":"0.8.x"},"main":"./lib/daemonize.js","readme":"About\n=======\n\nNode module for easy creation of daemons for Node 0.8.x\n\nFor Node 0.6.x compatibility see daemonize https://github.com/niegowski/node-daemonize\n\nJust write your daemon as plain node.js application \n(like `/examples/simple/app.js`) and a simple controller with Daemonize \n(like `/examples/simple/ctrl.js`). \n\n\nInstallation\n==============\n```\n$ npm install daemonize\n```\n\n\nExample\n=========\n\n``` js\nvar daemon = require(\"daemonize\").setup({\n    main: \"app.js\",\n    name: \"sampleapp\",\n    pidfile: \"sampleapp.pid\"\n});\n\nswitch (process.argv[2]) {\n    \n    case \"start\": \n        daemon.start().once(\"started\", function() {\n            process.exit();\n        });\n        break;\n    \n    case \"stop\":\n        daemon.stop();\n        break;\n    \n    default:\n        console.log(\"Usage: [start|stop]\");\n}\n```\n\nFor more examples see `examples` folder.\n\nDocumentation\n===============\n\nDaemonize works like standard `require()` but loaded module is \nforked to work in background as a daemon. \n\nKeep in mind that `stdin`, `stdout` and `stderr` are redirected \nto `/dev/null` so any output from daemon won't display in console. \nYou need to use file for logging (ie like `/examples/advanced/app.js`).\n\nAlso any uncaught exception won't be displayed in the console,\nso `process.on(\"uncaughtException\", ...)` should be used to\nredirect output to some log file.\n\n## daemonize.setup(options)\nCreates new `Daemon` instance. Supported `options`:\n\n* `main` - main application module file to run as daemon (required)\n* `name` - daemon name (default: basename of main)\n* `pidfile` - pidfile path (default: `/var/run/[name].pid`)\n* `user` - name or id of user (default: current)\n* `group` - name or id of group (default: current)\n* `silent` - disable printing info to console (default: `false`)\n* `stopTimeout` - interval of daemon killing retry (default: `2s`)\n\nAll paths are resolved relative to file that uses \"daemonize\".\n\nAll other options will be passed to the child process as posix style \narguments (`--myarg1=abc`).\n\n## Daemon\nDaemon control class. It references controlled daemon.\n\n### Event: \"starting\"\n`function() { }`\n\nEmitted when `start()` is called and if daemon is not already running.\n\n### Event: \"started\"\n`function(pid) { }`\n\nEmitted when daemon successfully started after calling `start()`.\n\n### Event: \"running\"\n`function(pid) { }`\n\nEmitted when `start()` is called and a daemon is already running.\n\n### Event: \"stopping\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a daemon is running.\n\n### Event: \"stopped\"\n`function(pid) { }`\n\nEmitted when daemon was successfully stopped after calling `stop()` \nor `kill()`.\n\n### Event: \"notrunning\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a deamon is not running.\n\n### Event: \"error\"\n`function(error) { }`\n\nEmitted when `start()` failed. `error` is instance of `Error`. \n`error.message` contains information what went wrong.\n\n### daemon.start()\nStart daemon asynchronously. Emits `running` in case when daemon is \nalready running and `starting` when daemon is not running. Then emits \n`started` when daemon is successfully started. \n\nEmits `error` in case of any problem during daemon startup.\n\n### daemon.stop()\nAsynchronously stop daemon. Sends `SIGTERM` to daemon every 2s (or time \nset in options). \n\nEmits `notrunning` when daemon is not running, otherwise \nemits `stopping` and then `stopped` when daemon successfully stopped. \n\n### daemon.kill()\nKill daemon asynchronously. Sends `SIGTERM` and after 2s `SIGKILL` to the \nchild if needed. Repeats sending `SIGKILL` every 2s untill daemon \nstops (interval can be changed in options).\n\nEmits events same as `stop()`.\n\n### daemon.status()\nSynchronously returns pid for running daemon or 0 when daemon is not running.\n\n### daemon.sendSignal(signal)\nSynchronously sends `signal` to daemon and returns pid of daemon or 0 when\ndaemon is not running.\n\n\nChangelog\n===========\n\nDaemonize is maintained under the [Semantic Versioning]\n(https://github.com/niegowski/semver/blob/master/semver.md) \nguidelines.\n\n### 0.4.0-rc.1 - Jul 29 2012\n  - Daemonize forked as Daemonize2 for Node 0.8.x compatibility\n  - Removed native module for setsid - using child_process.spawn detached\n  - Passing options via ipc instead of command line arguments\n  - Rethrowing wrapper exceptions via ipc\n\n### 0.3.2 - Jul 29 2012\n  - Daemonize is compatible only with Node 0.6.x\n\n### 0.3.1 - Apr 2 2012\n\n### 0.3.0 - Jan 29 2012\n  - Daemon emits Events instead of console.log()\n  - API change - events in place of callbacks\n\n### 0.2.2 - Jan 27 2012\n  - root priviledges no longer required\n  - changed error exit codes\n  - try to remove pidfile on daemon stop\n  - configurable timeouts for start monitoring and killing\n  - closing FD-s on daemon start\n  - better examples\n\n### 0.2.1 - Jan 26 2012\n  - fix for calling callback in stop/kill when process is not running\n\n### 0.2.0 - Jan 26 2012\n  - code refactor\n  - stop listening for uncaughtException\n  - logfile removed\n\n### 0.1.2 - Jan 25 2012\n  - fixed stdout, stderr replacement\n  - checking for daemon main module presence\n  - signals change (added custom signals)\n  - better log messages\n  - gracefull terminate in example app\n  - close logfile on process exit\n\n### 0.1.1 - Jan 24 2012\n  - print stacktrace for uncaughtException\n\n### 0.1.0 - Jan 24 2012\n  - First release \n\n\nLicense\n=========\n\n(The MIT License)\n\nCopyright (c) 2012 Kuba Niegowski\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","_id":"daemonize2@0.4.0-rc.1","dist":{"shasum":"9deefe60de1cbe51217e684c788b964e7bd53773","tarball":"https://registry.npmjs.org/daemonize2/-/daemonize2-0.4.0-rc.1.tgz","integrity":"sha512-r172M6LY49bAxRLvFZYv9N2JYYBv06I1cbApILaesEFRPmF8jWTawb2WuJl/Fn2kMpYsfYZP84wnDss+GD9E+w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICcleFrHUni+hAC2UVUTO4tsVVDknYTbNaGpnfPUwUHhAiBeYb4dMv9tm7+pc5Mg7p79pzvv6egdid3M+fFq30ZzfQ=="}]},"maintainers":[{"name":"niegowski","email":"kuba@niegowski.pl"}]},"0.4.0-rc.2":{"name":"daemonize2","version":"0.4.0-rc.2","description":"Module for easy creation of daemons for Node 0.8.x","author":{"name":"Kuba Niegowski"},"contributors":[],"homepage":"https://github.com/niegowski/node-daemonize2/","keywords":["daemon"],"engines":{"node":"0.8.x"},"main":"./lib/daemonize.js","readme":"About\n=======\n\nNode module for easy creation of daemons for Node 0.8.x\n\nFor Node 0.6.x compatibility see daemonize https://github.com/niegowski/node-daemonize\n\nJust write your daemon as plain node.js application \n(like `/examples/simple/app.js`) and a simple controller with Daemonize \n(like `/examples/simple/ctrl.js`). \n\n\nInstallation\n==============\n```\n$ npm install daemonize\n```\n\n\nExample\n=========\n\n``` js\nvar daemon = require(\"daemonize\").setup({\n    main: \"app.js\",\n    name: \"sampleapp\",\n    pidfile: \"sampleapp.pid\"\n});\n\nswitch (process.argv[2]) {\n    \n    case \"start\": \n        daemon.start();\n        break;\n    \n    case \"stop\":\n        daemon.stop();\n        break;\n    \n    default:\n        console.log(\"Usage: [start|stop]\");\n}\n```\n\nFor more examples see `examples` folder.\n\nDocumentation\n===============\n\nDaemonize works like standard `require()` but loaded module is \nforked to work in background as a daemon. \n\nKeep in mind that `stdin`, `stdout` and `stderr` are redirected \nto `/dev/null` so any output from daemon won't display in console. \nYou need to use file for logging (ie like `/examples/advanced/app.js`).\n\nAlso any uncaught exception won't be displayed in the console,\nso `process.on(\"uncaughtException\", ...)` should be used to\nredirect output to some log file.\n\n## daemonize.setup(options)\nCreates new `Daemon` instance. Supported `options`:\n\n* `main` - main application module file to run as daemon (required)\n* `name` - daemon name (default: basename of main)\n* `pidfile` - pidfile path (default: `/var/run/[name].pid`)\n* `user` - name or id of user (default: current)\n* `group` - name or id of group (default: current)\n* `silent` - disable printing info to console (default: `false`)\n* `stopTimeout` - interval of daemon killing retry (default: `2s`)\n\nAll paths are resolved relative to file that uses \"daemonize\".\n\nAll commandline arguments will be passed to the child process.\n\n## Daemon\nDaemon control class. It references controlled daemon.\n\n### Event: \"starting\"\n`function() { }`\n\nEmitted when `start()` is called and if daemon is not already running.\n\n### Event: \"started\"\n`function(pid) { }`\n\nEmitted when daemon successfully started after calling `start()`.\n\n### Event: \"running\"\n`function(pid) { }`\n\nEmitted when `start()` is called and a daemon is already running.\n\n### Event: \"stopping\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a daemon is running.\n\n### Event: \"stopped\"\n`function(pid) { }`\n\nEmitted when daemon was successfully stopped after calling `stop()` \nor `kill()`.\n\n### Event: \"notrunning\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a deamon is not running.\n\n### Event: \"error\"\n`function(error) { }`\n\nEmitted when `start()` failed. `error` is instance of `Error`. \n`error.message` contains information what went wrong.\n\n### daemon.start()\nStart daemon asynchronously. Emits `running` in case when daemon is \nalready running and `starting` when daemon is not running. Then emits \n`started` when daemon is successfully started. \n\nEmits `error` in case of any problem during daemon startup.\n\n### daemon.stop()\nAsynchronously stop daemon. Sends `SIGTERM` to daemon every 2s (or time \nset in options). \n\nEmits `notrunning` when daemon is not running, otherwise \nemits `stopping` and then `stopped` when daemon successfully stopped. \n\n### daemon.kill()\nKill daemon asynchronously. Sends `SIGTERM` and after 2s `SIGKILL` to the \nchild if needed. Repeats sending `SIGKILL` every 2s untill daemon \nstops (interval can be changed in options).\n\nEmits events same as `stop()`.\n\n### daemon.status()\nSynchronously returns pid for running daemon or 0 when daemon is not running.\n\n### daemon.sendSignal(signal)\nSynchronously sends `signal` to daemon and returns pid of daemon or 0 when\ndaemon is not running.\n\n\nChangelog\n===========\n\nDaemonize is maintained under the [Semantic Versioning]\n(https://github.com/niegowski/semver/blob/master/semver.md) \nguidelines.\n\n### 0.4.0-rc.2 - Jul 29 2012\n  - Passing command line arguments to child process\n\n### 0.4.0-rc.1 - Jul 29 2012\n  - Daemonize forked as Daemonize2 for Node 0.8.x compatibility\n  - Removed native module for setsid - using child_process.spawn detached\n  - Passing options via ipc instead of command line arguments\n  - Rethrowing wrapper exceptions via ipc\n\n### 0.3.2 - Jul 29 2012\n  - Daemonize is compatible only with Node 0.6.x\n\n### 0.3.1 - Apr 2 2012\n\n### 0.3.0 - Jan 29 2012\n  - Daemon emits Events instead of console.log()\n  - API change - events in place of callbacks\n\n### 0.2.2 - Jan 27 2012\n  - root priviledges no longer required\n  - changed error exit codes\n  - try to remove pidfile on daemon stop\n  - configurable timeouts for start monitoring and killing\n  - closing FD-s on daemon start\n  - better examples\n\n### 0.2.1 - Jan 26 2012\n  - fix for calling callback in stop/kill when process is not running\n\n### 0.2.0 - Jan 26 2012\n  - code refactor\n  - stop listening for uncaughtException\n  - logfile removed\n\n### 0.1.2 - Jan 25 2012\n  - fixed stdout, stderr replacement\n  - checking for daemon main module presence\n  - signals change (added custom signals)\n  - better log messages\n  - gracefull terminate in example app\n  - close logfile on process exit\n\n### 0.1.1 - Jan 24 2012\n  - print stacktrace for uncaughtException\n\n### 0.1.0 - Jan 24 2012\n  - First release \n\n\nLicense\n=========\n\n(The MIT License)\n\nCopyright (c) 2012 Kuba Niegowski\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","_id":"daemonize2@0.4.0-rc.2","dist":{"shasum":"116c280ebcd979e8dfb1659084d29e5b09ef9316","tarball":"https://registry.npmjs.org/daemonize2/-/daemonize2-0.4.0-rc.2.tgz","integrity":"sha512-wrrhLpeNrBxjHxEaFd/gNfzOdPR4PYsAbXS4eM1Al8iijFLnRlyf6KukRzeS8IkRbOKbwEygJjR/UHUAxMV6jg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDOO6LNOPh9gij07nW+8+upt9Ud8dCqzGfsRhV8RwI2JQIhAJPcM0V2NUXB4EYtCvbrqHT/jZ8bvRa2n/BfrRkHLkpN"}]},"maintainers":[{"name":"niegowski","email":"kuba@niegowski.pl"}]},"0.4.0-rc.3":{"name":"daemonize2","version":"0.4.0-rc.3","description":"Module for easy creation of daemons for Node 0.8.x","author":{"name":"Kuba Niegowski"},"contributors":[],"homepage":"https://github.com/niegowski/node-daemonize2/","keywords":["daemon"],"engines":{"node":"0.8.x"},"main":"./lib/daemonize.js","readme":"About\n=======\n\nNode module for easy creation of daemons for Node 0.8.x\n\nFor Node 0.6.x compatibility see daemonize https://github.com/niegowski/node-daemonize\n\nJust write your daemon as plain node.js application\n(like `/examples/simple/app.js`) and a simple controller with Daemonize\n(like `/examples/simple/ctrl.js`).\n\n\nInstallation\n==============\n```\n$ npm install daemonize\n```\n\n\nExample\n=========\n\n``` js\nvar daemon = require(\"daemonize2\").setup({\n    main: \"app.js\",\n    name: \"sampleapp\",\n    pidfile: \"sampleapp.pid\"\n});\n\nswitch (process.argv[2]) {\n\n    case \"start\":\n        daemon.start();\n        break;\n\n    case \"stop\":\n        daemon.stop();\n        break;\n\n    default:\n        console.log(\"Usage: [start|stop]\");\n}\n```\n\nFor more examples see `examples` folder.\n\nDocumentation\n===============\n\nDaemonize works like standard `require()` but loaded module is\nforked to work in background as a daemon.\n\nKeep in mind that `stdin`, `stdout` and `stderr` are redirected\nto `/dev/null` so any output from daemon won't display in console.\nYou need to use file for logging (ie like `/examples/advanced/app.js`).\n\nAlso any uncaught exception won't be displayed in the console,\nso `process.on(\"uncaughtException\", ...)` should be used to\nredirect output to some log file.\n\n## daemonize.setup(options)\nCreates new `Daemon` instance. Supported `options`:\n\n* `main` - main application module file to run as daemon (required)\n* `name` - daemon name (default: basename of main)\n* `pidfile` - pidfile path (default: `/var/run/[name].pid`)\n* `user` - name or id of user (default: current)\n* `group` - name or id of group (default: current)\n* `silent` - disable printing info to console (default: `false`)\n* `stopTimeout` - interval of daemon killing retry (default: `2s`)\n\nAll paths are resolved relative to file that uses \"daemonize\".\n\nAll commandline arguments will be passed to the child process.\n\n## Daemon\nDaemon control class. It references controlled daemon.\n\n### Event: \"starting\"\n`function() { }`\n\nEmitted when `start()` is called and if daemon is not already running.\n\n### Event: \"started\"\n`function(pid) { }`\n\nEmitted when daemon successfully started after calling `start()`.\n\n### Event: \"running\"\n`function(pid) { }`\n\nEmitted when `start()` is called and a daemon is already running.\n\n### Event: \"stopping\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a daemon is running.\n\n### Event: \"stopped\"\n`function(pid) { }`\n\nEmitted when daemon was successfully stopped after calling `stop()`\nor `kill()`.\n\n### Event: \"notrunning\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a deamon is not running.\n\n### Event: \"error\"\n`function(error) { }`\n\nEmitted when `start()` failed. `error` is instance of `Error`.\n`error.message` contains information what went wrong.\n\n### daemon.start([listener])\nStart daemon asynchronously. Emits `running` in case when daemon is\nalready running and `starting` when daemon is not running. Then emits\n`started` when daemon is successfully started.\n\nOptional `listener` callback is once called on `running` or `started` event.\n\nEmits `error` in case of any problem during daemon startup.\n\n### daemon.stop([listener])\nAsynchronously stop daemon. Sends `SIGTERM` to daemon every 2s (or time\nset in options).\n\nEmits `notrunning` when daemon is not running, otherwise\nemits `stopping` and then `stopped` when daemon successfully stopped.\n\nOptional `listener` callback is once called on `notrunning` or `stopped` event.\n\n### daemon.kill([listener])\nKill daemon asynchronously. Sends `SIGTERM` and after 2s `SIGKILL` to the\nchild if needed. Repeats sending `SIGKILL` every 2s untill daemon\nstops (interval can be changed in options).\n\nEmits events same as `stop()`.\n\nOptional `listener` callback is same as `stop`.\n\n### daemon.status()\nSynchronously returns pid for running daemon or 0 when daemon is not running.\n\n### daemon.sendSignal(signal)\nSynchronously sends `signal` to daemon and returns pid of daemon or 0 when\ndaemon is not running.\n\n\nChangelog\n===========\n\nDaemonize is maintained under the [Semantic Versioning]\n(https://github.com/niegowski/semver/blob/master/semver.md)\nguidelines.\n\n### 0.4.0-rc.3 - Aug 14 2012\n  - Optional callback argument for start, stop and kill\n\n### 0.4.0-rc.2 - Jul 29 2012\n  - Passing command line arguments to child process\n\n### 0.4.0-rc.1 - Jul 29 2012\n  - Daemonize forked as Daemonize2 for Node 0.8.x compatibility\n  - Removed native module for setsid - using child_process.spawn detached\n  - Passing options via ipc instead of command line arguments\n  - Rethrowing wrapper exceptions via ipc\n\n### 0.3.2 - Jul 29 2012\n  - Daemonize is compatible only with Node 0.6.x\n\n### 0.3.1 - Apr 2 2012\n\n### 0.3.0 - Jan 29 2012\n  - Daemon emits Events instead of console.log()\n  - API change - events in place of callbacks\n\n### 0.2.2 - Jan 27 2012\n  - root priviledges no longer required\n  - changed error exit codes\n  - try to remove pidfile on daemon stop\n  - configurable timeouts for start monitoring and killing\n  - closing FD-s on daemon start\n  - better examples\n\n### 0.2.1 - Jan 26 2012\n  - fix for calling callback in stop/kill when process is not running\n\n### 0.2.0 - Jan 26 2012\n  - code refactor\n  - stop listening for uncaughtException\n  - logfile removed\n\n### 0.1.2 - Jan 25 2012\n  - fixed stdout, stderr replacement\n  - checking for daemon main module presence\n  - signals change (added custom signals)\n  - better log messages\n  - gracefull terminate in example app\n  - close logfile on process exit\n\n### 0.1.1 - Jan 24 2012\n  - print stacktrace for uncaughtException\n\n### 0.1.0 - Jan 24 2012\n  - First release\n\n\nLicense\n=========\n\n(The MIT License)\n\nCopyright (c) 2012 Kuba Niegowski\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","_id":"daemonize2@0.4.0-rc.3","dist":{"shasum":"f9ff90571de26c1304fe331b7caa308635a40379","tarball":"https://registry.npmjs.org/daemonize2/-/daemonize2-0.4.0-rc.3.tgz","integrity":"sha512-Q41Hbh0HqVY/9bft00MOPrPAoVwuMtLhO0xnSTyntVagYQc/s+Ecc9qQCPNxsPP06FW9864SBIvDabK7ab2zfQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICtJ0yI0D+4ZPTAvD0G1ziTDkoBkkIXtkxv6Wom87VE0AiEAwzeGQHEM8PmyUHGh5btoR/kM0L6Ez/3Raqi69zqrqNw="}]},"maintainers":[{"name":"niegowski","email":"kuba@niegowski.pl"}]},"0.4.0-rc.4":{"name":"daemonize2","version":"0.4.0-rc.4","description":"Module for easy creation of daemons for Node 0.8.x","author":{"name":"Kuba Niegowski"},"contributors":[],"homepage":"https://github.com/niegowski/node-daemonize2/","keywords":["daemon"],"engines":{"node":"0.8.x"},"main":"./lib/daemonize.js","readme":"About\n=======\n\nNode module for easy creation of daemons for Node 0.8.x\n\nFor Node 0.6.x compatibility see daemonize https://github.com/niegowski/node-daemonize\n\nJust write your daemon as plain node.js application\n(like `/examples/simple/app.js`) and a simple controller with Daemonize\n(like `/examples/simple/ctrl.js`).\n\n\nInstallation\n==============\n```\n$ npm install daemonize\n```\n\n\nExample\n=========\n\n``` js\nvar daemon = require(\"daemonize2\").setup({\n    main: \"app.js\",\n    name: \"sampleapp\",\n    pidfile: \"sampleapp.pid\"\n});\n\nswitch (process.argv[2]) {\n\n    case \"start\":\n        daemon.start();\n        break;\n\n    case \"stop\":\n        daemon.stop();\n        break;\n\n    default:\n        console.log(\"Usage: [start|stop]\");\n}\n```\n\nFor more examples see `examples` folder.\n\nDocumentation\n===============\n\nDaemonize works like standard `require()` but loaded module is\nforked to work in background as a daemon.\n\nKeep in mind that `stdin`, `stdout` and `stderr` are redirected\nto `/dev/null` so any output from daemon won't display in console.\nYou need to use file for logging (ie like `/examples/advanced/app.js`).\n\nAlso any uncaught exception won't be displayed in the console,\nso `process.on(\"uncaughtException\", ...)` should be used to\nredirect output to some log file.\n\n## daemonize.setup(options)\nCreates new `Daemon` instance. Supported `options`:\n\n* `main` - main application module file to run as daemon (required)\n* `name` - daemon name (default: basename of main)\n* `pidfile` - pidfile path (default: `/var/run/[name].pid`)\n* `user` - name or id of user (default: current)\n* `group` - name or id of group (default: current)\n* `silent` - disable printing info to console (default: `false`)\n* `stopTimeout` - interval of daemon killing retry (default: `2s`)\n\nAll paths are resolved relative to file that uses \"daemonize\".\n\nAll commandline arguments will be passed to the child process.\n\n## Daemon\nDaemon control class. It references controlled daemon.\n\n### Event: \"starting\"\n`function() { }`\n\nEmitted when `start()` is called and if daemon is not already running.\n\n### Event: \"started\"\n`function(pid) { }`\n\nEmitted when daemon successfully started after calling `start()`.\n\n### Event: \"running\"\n`function(pid) { }`\n\nEmitted when `start()` is called and a daemon is already running.\n\n### Event: \"stopping\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a daemon is running.\n\n### Event: \"stopped\"\n`function(pid) { }`\n\nEmitted when daemon was successfully stopped after calling `stop()`\nor `kill()`.\n\n### Event: \"notrunning\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a deamon is not running.\n\n### Event: \"error\"\n`function(error) { }`\n\nEmitted when `start()` failed. `error` is instance of `Error`.\n`error.message` contains information what went wrong.\n\n### daemon.start([listener])\nStart daemon asynchronously. Emits `running` in case when daemon is\nalready running and `starting` when daemon is not running. Then emits\n`started` when daemon is successfully started.\n\nOptional `listener` callback is once called on `running`, `started` or `error`\nevent. The callback gets two arguments `(err, pid)`.\n\nEmits `error` in case of any problem during daemon startup.\n\n### daemon.stop([listener])\nAsynchronously stop daemon. Sends `SIGTERM` to daemon every 2s (or time\nset in options).\n\nEmits `notrunning` when daemon is not running, otherwise\nemits `stopping` and then `stopped` when daemon successfully stopped.\n\nOptional `listener` callback is once called on `notrunning`, `stopped` or\n`error` event. The callback gets two arguments `(err, pid)`.\n\n### daemon.kill([listener])\nKill daemon asynchronously. Sends `SIGTERM` and after 2s `SIGKILL` to the\nchild if needed. Repeats sending `SIGKILL` every 2s untill daemon\nstops (interval can be changed in options).\n\nEmits events same as `stop()`.\n\nOptional `listener` callback is same as `stop`.\n\n### daemon.status()\nSynchronously returns pid for running daemon or 0 when daemon is not running.\n\n### daemon.sendSignal(signal)\nSynchronously sends `signal` to daemon and returns pid of daemon or 0 when\ndaemon is not running.\n\n\nChangelog\n===========\n\nDaemonize is maintained under the [Semantic Versioning]\n(https://github.com/niegowski/semver/blob/master/semver.md)\nguidelines.\n\n### 0.4.0-rc.4 - Aug 16 2012\n  - The callback for start, stop and kill handles errors\n\n### 0.4.0-rc.3 - Aug 14 2012\n  - Optional callback argument for start, stop and kill\n\n### 0.4.0-rc.2 - Jul 29 2012\n  - Passing command line arguments to child process\n\n### 0.4.0-rc.1 - Jul 29 2012\n  - Daemonize forked as Daemonize2 for Node 0.8.x compatibility\n  - Removed native module for setsid - using child_process.spawn detached\n  - Passing options via ipc instead of command line arguments\n  - Rethrowing wrapper exceptions via ipc\n\n### 0.3.2 - Jul 29 2012\n  - Daemonize is compatible only with Node 0.6.x\n\n### 0.3.1 - Apr 2 2012\n\n### 0.3.0 - Jan 29 2012\n  - Daemon emits Events instead of console.log()\n  - API change - events in place of callbacks\n\n### 0.2.2 - Jan 27 2012\n  - root priviledges no longer required\n  - changed error exit codes\n  - try to remove pidfile on daemon stop\n  - configurable timeouts for start monitoring and killing\n  - closing FD-s on daemon start\n  - better examples\n\n### 0.2.1 - Jan 26 2012\n  - fix for calling callback in stop/kill when process is not running\n\n### 0.2.0 - Jan 26 2012\n  - code refactor\n  - stop listening for uncaughtException\n  - logfile removed\n\n### 0.1.2 - Jan 25 2012\n  - fixed stdout, stderr replacement\n  - checking for daemon main module presence\n  - signals change (added custom signals)\n  - better log messages\n  - gracefull terminate in example app\n  - close logfile on process exit\n\n### 0.1.1 - Jan 24 2012\n  - print stacktrace for uncaughtException\n\n### 0.1.0 - Jan 24 2012\n  - First release\n\n\nLicense\n=========\n\n(The MIT License)\n\nCopyright (c) 2012 Kuba Niegowski\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","_id":"daemonize2@0.4.0-rc.4","dist":{"shasum":"f0e4e0134f7e6c1c2292d1690078d229afbfb586","tarball":"https://registry.npmjs.org/daemonize2/-/daemonize2-0.4.0-rc.4.tgz","integrity":"sha512-gMs0oeqq4hP+C+dqAB28SX2795dFFf7YaV9BNu/WKTUp2wWMXNgmNYp12tGaiwTBQNH4q4l9j1yVsj4m/xH4Rw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD/f3GZJM1+5RlpwzfFvjjHTnp7SvUO+ZnL5NH+EVGzYAIgbvGcDM7zs9SwXhM4gapm4+ZisGYtcoh2ziEqMOl/YiI="}]},"maintainers":[{"name":"niegowski","email":"kuba@niegowski.pl"}]},"0.4.0-rc.5":{"name":"daemonize2","version":"0.4.0-rc.5","description":"Module for easy creation of daemons for Node 0.8.x","author":{"name":"Kuba Niegowski"},"contributors":[],"homepage":"https://github.com/niegowski/node-daemonize2/","keywords":["daemon"],"engines":{"node":"0.8.x"},"main":"./lib/daemonize.js","readme":"About\n=======\n\nNode module for easy creation of daemons for Node 0.8.x\n\nFor Node 0.6.x compatibility see daemonize https://github.com/niegowski/node-daemonize\n\nJust write your daemon as plain node.js application\n(like `/examples/simple/app.js`) and a simple controller with Daemonize\n(like `/examples/simple/ctrl.js`).\n\n\nInstallation\n==============\n```\n$ npm install daemonize2\n```\n\n\nExample\n=========\n\n``` js\nvar daemon = require(\"daemonize2\").setup({\n    main: \"app.js\",\n    name: \"sampleapp\",\n    pidfile: \"sampleapp.pid\"\n});\n\nswitch (process.argv[2]) {\n\n    case \"start\":\n        daemon.start();\n        break;\n\n    case \"stop\":\n        daemon.stop();\n        break;\n\n    default:\n        console.log(\"Usage: [start|stop]\");\n}\n```\n\nFor more examples see `examples` folder.\n\nDocumentation\n===============\n\nDaemonize works like standard `require()` but loaded module is\nforked to work in background as a daemon.\n\nKeep in mind that `stdin`, `stdout` and `stderr` are redirected\nto `/dev/null` so any output from daemon won't display in console.\nYou need to use file for logging (ie like `/examples/advanced/app.js`).\n\nAlso any uncaught exception won't be displayed in the console,\nso `process.on(\"uncaughtException\", ...)` should be used to\nredirect output to some log file.\n\n## daemonize.setup(options)\nCreates new `Daemon` instance. Supported `options`:\n\n* `main` - main application module file to run as daemon (required)\n* `name` - daemon name (default: basename of main)\n* `pidfile` - pidfile path (default: `/var/run/[name].pid`)\n* `user` - name or id of user (default: current)\n* `group` - name or id of group (default: current)\n* `silent` - disable printing info to console (default: `false`)\n* `stopTimeout` - interval of daemon killing retry (default: `2s`)\n\nAll paths are resolved relative to file that uses \"daemonize\".\n\nAll commandline arguments will be passed to the child process.\n\n## Daemon\nDaemon control class. It references controlled daemon.\n\n### Event: \"starting\"\n`function() { }`\n\nEmitted when `start()` is called and if daemon is not already running.\n\n### Event: \"started\"\n`function(pid) { }`\n\nEmitted when daemon successfully started after calling `start()`.\n\n### Event: \"running\"\n`function(pid) { }`\n\nEmitted when `start()` is called and a daemon is already running.\n\n### Event: \"stopping\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a daemon is running.\n\n### Event: \"stopped\"\n`function(pid) { }`\n\nEmitted when daemon was successfully stopped after calling `stop()`\nor `kill()`.\n\n### Event: \"notrunning\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a deamon is not running.\n\n### Event: \"error\"\n`function(error) { }`\n\nEmitted when `start()` failed. `error` is instance of `Error`.\n`error.message` contains information what went wrong.\n\n### daemon.start([listener])\nStart daemon asynchronously. Emits `running` in case when daemon is\nalready running and `starting` when daemon is not running. Then emits\n`started` when daemon is successfully started.\n\nOptional `listener` callback is once called on `running`, `started` or `error`\nevent. The callback gets two arguments `(err, pid)`.\n\nEmits `error` in case of any problem during daemon startup.\n\n### daemon.stop([listener])\nAsynchronously stop daemon. Sends `SIGTERM` to daemon every 2s (or time\nset in options).\n\nEmits `notrunning` when daemon is not running, otherwise\nemits `stopping` and then `stopped` when daemon successfully stopped.\n\nOptional `listener` callback is once called on `notrunning`, `stopped` or\n`error` event. The callback gets two arguments `(err, pid)`.\n\n### daemon.kill([listener])\nKill daemon asynchronously. Sends `SIGTERM` and after 2s `SIGKILL` to the\nchild if needed. Repeats sending `SIGKILL` every 2s untill daemon\nstops (interval can be changed in options).\n\nEmits events same as `stop()`.\n\nOptional `listener` callback is same as `stop`.\n\n### daemon.status()\nSynchronously returns pid for running daemon or 0 when daemon is not running.\n\n### daemon.sendSignal(signal)\nSynchronously sends `signal` to daemon and returns pid of daemon or 0 when\ndaemon is not running.\n\n\nChangelog\n===========\n\nDaemonize is maintained under the [Semantic Versioning]\n(https://github.com/niegowski/semver/blob/master/semver.md)\nguidelines.\n\n### 0.4.0-rc.5 - Aug 28 2012\n  - Wrapper is transparent now\n\n### 0.4.0-rc.4 - Aug 16 2012\n  - The callback for start, stop and kill handles errors\n\n### 0.4.0-rc.3 - Aug 14 2012\n  - Optional callback argument for start, stop and kill\n\n### 0.4.0-rc.2 - Jul 29 2012\n  - Passing command line arguments to child process\n\n### 0.4.0-rc.1 - Jul 29 2012\n  - Daemonize forked as Daemonize2 for Node 0.8.x compatibility\n  - Removed native module for setsid - using child_process.spawn detached\n  - Passing options via ipc instead of command line arguments\n  - Rethrowing wrapper exceptions via ipc\n\n### 0.3.2 - Jul 29 2012\n  - Daemonize is compatible only with Node 0.6.x\n\n### 0.3.1 - Apr 2 2012\n\n### 0.3.0 - Jan 29 2012\n  - Daemon emits Events instead of console.log()\n  - API change - events in place of callbacks\n\n### 0.2.2 - Jan 27 2012\n  - root priviledges no longer required\n  - changed error exit codes\n  - try to remove pidfile on daemon stop\n  - configurable timeouts for start monitoring and killing\n  - closing FD-s on daemon start\n  - better examples\n\n### 0.2.1 - Jan 26 2012\n  - fix for calling callback in stop/kill when process is not running\n\n### 0.2.0 - Jan 26 2012\n  - code refactor\n  - stop listening for uncaughtException\n  - logfile removed\n\n### 0.1.2 - Jan 25 2012\n  - fixed stdout, stderr replacement\n  - checking for daemon main module presence\n  - signals change (added custom signals)\n  - better log messages\n  - gracefull terminate in example app\n  - close logfile on process exit\n\n### 0.1.1 - Jan 24 2012\n  - print stacktrace for uncaughtException\n\n### 0.1.0 - Jan 24 2012\n  - First release\n\n\nLicense\n=========\n\n(The MIT License)\n\nCopyright (c) 2012 Kuba Niegowski\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","_id":"daemonize2@0.4.0-rc.5","dist":{"shasum":"57a990aaf50c266fa1c34446ef75ea60b831f69b","tarball":"https://registry.npmjs.org/daemonize2/-/daemonize2-0.4.0-rc.5.tgz","integrity":"sha512-/JR31jdngfR4FNLe9dz1TVfx4lJKZKYAqZJuRLN4iLPM1c/kxr82JFIcAsd3A8C+tmPGjjdFT3rHNRDWJ5wVlw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDM/9aUtdvV5e8pnksMl3GQklL/hGHMMtTTztaWF7LVUAIgVvZiFaGuLgGzQa1mzWLPMTFi3U7hOuBu//jjsaiOLR8="}]},"maintainers":[{"name":"niegowski","email":"kuba@niegowski.pl"}]},"0.4.0-rc.6":{"name":"daemonize2","version":"0.4.0-rc.6","description":"Module for easy creation of daemons for Node 0.8.x","author":{"name":"Kuba Niegowski"},"contributors":[],"homepage":"https://github.com/niegowski/node-daemonize2/","keywords":["daemon"],"engines":{"node":"0.8.x"},"main":"./lib/daemonize.js","readme":"About\n=======\n\nNode module for easy creation of daemons for Node 0.8.x\n\nFor Node 0.6.x compatibility see daemonize https://github.com/niegowski/node-daemonize\n\nJust write your daemon as plain node.js application\n(like `/examples/simple/app.js`) and a simple controller with Daemonize\n(like `/examples/simple/ctrl.js`).\n\n\nInstallation\n==============\n```\n$ npm install daemonize2\n```\n\n\nExample\n=========\n\n``` js\nvar daemon = require(\"daemonize2\").setup({\n    main: \"app.js\",\n    name: \"sampleapp\",\n    pidfile: \"sampleapp.pid\"\n});\n\nswitch (process.argv[2]) {\n\n    case \"start\":\n        daemon.start();\n        break;\n\n    case \"stop\":\n        daemon.stop();\n        break;\n\n    default:\n        console.log(\"Usage: [start|stop]\");\n}\n```\n\nFor more examples see `examples` folder.\n\nDocumentation\n===============\n\nDaemonize works like standard `require()` but loaded module is\nforked to work in background as a daemon.\n\nKeep in mind that `stdin`, `stdout` and `stderr` are redirected\nto `/dev/null` so any output from daemon won't display in console.\nYou need to use file for logging (ie like `/examples/advanced/app.js`).\n\nAlso any uncaught exception won't be displayed in the console,\nso `process.on(\"uncaughtException\", ...)` should be used to\nredirect output to some log file.\n\n## daemonize.setup(options)\nCreates new `Daemon` instance. Supported `options`:\n\n* `main` - main application module file to run as daemon (required)\n* `name` - daemon name (default: basename of main)\n* `pidfile` - pidfile path (default: `/var/run/[name].pid`)\n* `user` - name or id of user (default: current)\n* `group` - name or id of group (default: current)\n* `silent` - disable printing info to console (default: `false`)\n* `stopTimeout` - interval of daemon killing retry (default: `2s`)\n\nAll paths are resolved relative to file that uses \"daemonize\".\n\nAll commandline arguments will be passed to the child process.\n\n## Daemon\nDaemon control class. It references controlled daemon.\n\n### Event: \"starting\"\n`function() { }`\n\nEmitted when `start()` is called and if daemon is not already running.\n\n### Event: \"started\"\n`function(pid) { }`\n\nEmitted when daemon successfully started after calling `start()`.\n\n### Event: \"running\"\n`function(pid) { }`\n\nEmitted when `start()` is called and a daemon is already running.\n\n### Event: \"stopping\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a daemon is running.\n\n### Event: \"stopped\"\n`function(pid) { }`\n\nEmitted when daemon was successfully stopped after calling `stop()`\nor `kill()`.\n\n### Event: \"notrunning\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a deamon is not running.\n\n### Event: \"error\"\n`function(error) { }`\n\nEmitted when `start()` failed. `error` is instance of `Error`.\n`error.message` contains information what went wrong.\n\n### daemon.start([listener])\nStart daemon asynchronously. Emits `running` in case when daemon is\nalready running and `starting` when daemon is not running. Then emits\n`started` when daemon is successfully started.\n\nOptional `listener` callback is once called on `running`, `started` or `error`\nevent. The callback gets two arguments `(err, pid)`.\n\nEmits `error` in case of any problem during daemon startup.\n\n### daemon.stop([listener])\nAsynchronously stop daemon. Sends `SIGTERM` to daemon every 2s (or time\nset in options).\n\nEmits `notrunning` when daemon is not running, otherwise\nemits `stopping` and then `stopped` when daemon successfully stopped.\n\nOptional `listener` callback is once called on `notrunning`, `stopped` or\n`error` event. The callback gets two arguments `(err, pid)`.\n\n### daemon.kill([listener])\nKill daemon asynchronously. Sends `SIGTERM` and after 2s `SIGKILL` to the\nchild if needed. Repeats sending `SIGKILL` every 2s untill daemon\nstops (interval can be changed in options).\n\nEmits events same as `stop()`.\n\nOptional `listener` callback is same as `stop`.\n\n### daemon.status()\nSynchronously returns pid for running daemon or 0 when daemon is not running.\n\n### daemon.sendSignal(signal)\nSynchronously sends `signal` to daemon and returns pid of daemon or 0 when\ndaemon is not running.\n\n\nChangelog\n===========\n\nDaemonize is maintained under the [Semantic Versioning]\n(https://github.com/niegowski/semver/blob/master/semver.md)\nguidelines.\n\n### 0.4.0-rc.6 - Nov 28 2012\n  - args option to enable node arguments ie --debug\n  - fix for: Wrapper seems to eat one argument\n\n### 0.4.0-rc.5 - Aug 28 2012\n  - Wrapper is transparent now\n\n### 0.4.0-rc.4 - Aug 16 2012\n  - The callback for start, stop and kill handles errors\n\n### 0.4.0-rc.3 - Aug 14 2012\n  - Optional callback argument for start, stop and kill\n\n### 0.4.0-rc.2 - Jul 29 2012\n  - Passing command line arguments to child process\n\n### 0.4.0-rc.1 - Jul 29 2012\n  - Daemonize forked as Daemonize2 for Node 0.8.x compatibility\n  - Removed native module for setsid - using child_process.spawn detached\n  - Passing options via ipc instead of command line arguments\n  - Rethrowing wrapper exceptions via ipc\n\n### 0.3.2 - Jul 29 2012\n  - Daemonize is compatible only with Node 0.6.x\n\n### 0.3.1 - Apr 2 2012\n\n### 0.3.0 - Jan 29 2012\n  - Daemon emits Events instead of console.log()\n  - API change - events in place of callbacks\n\n### 0.2.2 - Jan 27 2012\n  - root priviledges no longer required\n  - changed error exit codes\n  - try to remove pidfile on daemon stop\n  - configurable timeouts for start monitoring and killing\n  - closing FD-s on daemon start\n  - better examples\n\n### 0.2.1 - Jan 26 2012\n  - fix for calling callback in stop/kill when process is not running\n\n### 0.2.0 - Jan 26 2012\n  - code refactor\n  - stop listening for uncaughtException\n  - logfile removed\n\n### 0.1.2 - Jan 25 2012\n  - fixed stdout, stderr replacement\n  - checking for daemon main module presence\n  - signals change (added custom signals)\n  - better log messages\n  - gracefull terminate in example app\n  - close logfile on process exit\n\n### 0.1.1 - Jan 24 2012\n  - print stacktrace for uncaughtException\n\n### 0.1.0 - Jan 24 2012\n  - First release\n\n\nLicense\n=========\n\n(The MIT License)\n\nCopyright (c) 2012 Kuba Niegowski\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","_id":"daemonize2@0.4.0-rc.6","dist":{"shasum":"9477b3145ae6077f123bc9b0d31666ea99a0b941","tarball":"https://registry.npmjs.org/daemonize2/-/daemonize2-0.4.0-rc.6.tgz","integrity":"sha512-fHAQLnHo489q6ew2YZygEBp3/uypITaIxX7hp074UEvLfbaZL63Atf5DkNl0qBoAx+ZkZetiSfv9rGXGOF/lpQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCeT8AjDTeIjqos5SZ1wgyyD+D3LI+cTxa41cabB2t9jgIhALCzB3SFOog4DZz8OaPiFgiwRPjX3/dTptMd8jt7CUi9"}]},"maintainers":[{"name":"niegowski","email":"kuba@niegowski.pl"}]},"0.4.0":{"name":"daemonize2","version":"0.4.0","description":"Module for easy creation of daemons for Node 0.8.x","author":{"name":"Kuba Niegowski"},"contributors":[],"homepage":"https://github.com/niegowski/node-daemonize2/","keywords":["daemon"],"engines":{"node":"0.8.x"},"main":"./lib/daemonize.js","readme":"About\n=======\n\nNode module for easy creation of daemons for Node 0.8.x\n\nFor Node 0.6.x compatibility see daemonize https://github.com/niegowski/node-daemonize\n\nJust write your daemon as plain node.js application\n(like `/examples/simple/app.js`) and a simple controller with Daemonize\n(like `/examples/simple/ctrl.js`).\n\n\nInstallation\n==============\n```\n$ npm install daemonize2\n```\n\n\nExample\n=========\n\n``` js\nvar daemon = require(\"daemonize2\").setup({\n    main: \"app.js\",\n    name: \"sampleapp\",\n    pidfile: \"sampleapp.pid\"\n});\n\nswitch (process.argv[2]) {\n\n    case \"start\":\n        daemon.start();\n        break;\n\n    case \"stop\":\n        daemon.stop();\n        break;\n\n    default:\n        console.log(\"Usage: [start|stop]\");\n}\n```\n\nFor more examples see `examples` folder.\n\nDocumentation\n===============\n\nDaemonize works like standard `require()` but loaded module is\nforked to work in background as a daemon.\n\nKeep in mind that `stdin`, `stdout` and `stderr` are redirected\nto `/dev/null` so any output from daemon won't display in console.\nYou need to use file for logging (ie like `/examples/advanced/app.js`).\n\nAlso any uncaught exception won't be displayed in the console,\nso `process.on(\"uncaughtException\", ...)` should be used to\nredirect output to some log file.\n\n## daemonize.setup(options)\nCreates new `Daemon` instance. Supported `options`:\n\n* `main` - main application module file to run as daemon (required)\n* `name` - daemon name (default: basename of main)\n* `pidfile` - pidfile path (default: `/var/run/[name].pid`)\n* `user` - name or id of user (default: current)\n* `group` - name or id of group (default: current)\n* `silent` - disable printing info to console (default: `false`)\n* `stopTimeout` - interval of daemon killing retry (default: `2s`)\n* `args` - additional node runtime arguments, ie `--debug`\n* `argv` - argv for daemon (default: `process.argv.slice(2)`)\n\nAll paths are resolved relative to file that uses \"daemonize\".\n\nAll commandline arguments will be passed to the child process unless\noverriden with `argv` option.\n\n## Daemon\nDaemon control class. It references controlled daemon.\n\n### Event: \"starting\"\n`function() { }`\n\nEmitted when `start()` is called and if daemon is not already running.\n\n### Event: \"started\"\n`function(pid) { }`\n\nEmitted when daemon successfully started after calling `start()`.\n\n### Event: \"running\"\n`function(pid) { }`\n\nEmitted when `start()` is called and a daemon is already running.\n\n### Event: \"stopping\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a daemon is running.\n\n### Event: \"stopped\"\n`function(pid) { }`\n\nEmitted when daemon was successfully stopped after calling `stop()`\nor `kill()`.\n\n### Event: \"notrunning\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a deamon is not running.\n\n### Event: \"error\"\n`function(error) { }`\n\nEmitted when `start()` failed. `error` is instance of `Error`.\n`error.message` contains information what went wrong.\n\n### daemon.start([listener])\nStart daemon asynchronously. Emits `running` in case when daemon is\nalready running and `starting` when daemon is not running. Then emits\n`started` when daemon is successfully started.\n\nOptional `listener` callback is once called on `running`, `started` or `error`\nevent. The callback gets two arguments `(err, pid)`.\n\nEmits `error` in case of any problem during daemon startup.\n\n### daemon.stop([listener])\nAsynchronously stop daemon. Sends `SIGTERM` to daemon every 2s (or time\nset in options).\n\nEmits `notrunning` when daemon is not running, otherwise\nemits `stopping` and then `stopped` when daemon successfully stopped.\n\nOptional `listener` callback is once called on `notrunning`, `stopped` or\n`error` event. The callback gets two arguments `(err, pid)`.\n\n### daemon.kill([listener])\nKill daemon asynchronously. Sends `SIGTERM` and after 2s `SIGKILL` to the\nchild if needed. Repeats sending `SIGKILL` every 2s untill daemon\nstops (interval can be changed in options).\n\nEmits events same as `stop()`.\n\nOptional `listener` callback is same as `stop`.\n\n### daemon.status()\nSynchronously returns pid for running daemon or 0 when daemon is not running.\n\n### daemon.sendSignal(signal)\nSynchronously sends `signal` to daemon and returns pid of daemon or 0 when\ndaemon is not running.\n\n\nChangelog\n===========\n\nDaemonize is maintained under the [Semantic Versioning]\n(https://github.com/niegowski/semver/blob/master/semver.md)\nguidelines.\n\n### 0.4.0 - Jun 05 2013\n  - added argv option\n\n### 0.4.0-rc.6 - Nov 28 2012\n  - args option to enable node arguments ie --debug\n  - fix for: Wrapper seems to eat one argument\n\n### 0.4.0-rc.5 - Aug 28 2012\n  - Wrapper is transparent now\n\n### 0.4.0-rc.4 - Aug 16 2012\n  - The callback for start, stop and kill handles errors\n\n### 0.4.0-rc.3 - Aug 14 2012\n  - Optional callback argument for start, stop and kill\n\n### 0.4.0-rc.2 - Jul 29 2012\n  - Passing command line arguments to child process\n\n### 0.4.0-rc.1 - Jul 29 2012\n  - Daemonize forked as Daemonize2 for Node 0.8.x compatibility\n  - Removed native module for setsid - using child_process.spawn detached\n  - Passing options via ipc instead of command line arguments\n  - Rethrowing wrapper exceptions via ipc\n\n### 0.3.2 - Jul 29 2012\n  - Daemonize is compatible only with Node 0.6.x\n\n### 0.3.1 - Apr 2 2012\n\n### 0.3.0 - Jan 29 2012\n  - Daemon emits Events instead of console.log()\n  - API change - events in place of callbacks\n\n### 0.2.2 - Jan 27 2012\n  - root priviledges no longer required\n  - changed error exit codes\n  - try to remove pidfile on daemon stop\n  - configurable timeouts for start monitoring and killing\n  - closing FD-s on daemon start\n  - better examples\n\n### 0.2.1 - Jan 26 2012\n  - fix for calling callback in stop/kill when process is not running\n\n### 0.2.0 - Jan 26 2012\n  - code refactor\n  - stop listening for uncaughtException\n  - logfile removed\n\n### 0.1.2 - Jan 25 2012\n  - fixed stdout, stderr replacement\n  - checking for daemon main module presence\n  - signals change (added custom signals)\n  - better log messages\n  - gracefull terminate in example app\n  - close logfile on process exit\n\n### 0.1.1 - Jan 24 2012\n  - print stacktrace for uncaughtException\n\n### 0.1.0 - Jan 24 2012\n  - First release\n\n\nLicense\n=========\n\n(The MIT License)\n\nCopyright (c) 2012 Kuba Niegowski\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","readmeFilename":"README.md","_id":"daemonize2@0.4.0","dist":{"shasum":"07cf8a66ddb67971df125ee460b78d639115e9fd","tarball":"https://registry.npmjs.org/daemonize2/-/daemonize2-0.4.0.tgz","integrity":"sha512-CQBiHhJ3p2VSJdxdbZhTTt+d2tWE4gMp2/YyPGt4VsZmSId2dkpbeUk7eFp06t7v4ql1VX4W5cAkda8dBAmkYA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCDCNckJPg06u8ifHeuMDBVoM1bGLryjCOfIL1qONzCogIhAJKQOF+/SL6qvdjZufRi1JeThlzbE9QPbtsYSduXewgq"}]},"_npmVersion":"1.2.0","_npmUser":{"name":"niegowski","email":"kuba@niegowski.pl"},"maintainers":[{"name":"niegowski","email":"kuba@niegowski.pl"}]},"0.4.1":{"name":"daemonize2","version":"0.4.1","description":"Module for easy creation of daemons for Node 0.8.x","author":{"name":"Kuba Niegowski"},"contributors":[],"homepage":"https://github.com/niegowski/node-daemonize2/","keywords":["daemon"],"engines":{"node":"0.8.x"},"main":"./lib/daemonize.js","readme":"About\n=======\n\nNode module for easy creation of daemons for Node 0.8.x\n\nFor Node 0.6.x compatibility see daemonize https://github.com/niegowski/node-daemonize\n\nJust write your daemon as plain node.js application\n(like `/examples/simple/app.js`) and a simple controller with Daemonize\n(like `/examples/simple/ctrl.js`).\n\n\nInstallation\n==============\n```\n$ npm install daemonize2\n```\n\n\nExample\n=========\n\n``` js\nvar daemon = require(\"daemonize2\").setup({\n    main: \"app.js\",\n    name: \"sampleapp\",\n    pidfile: \"sampleapp.pid\"\n});\n\nswitch (process.argv[2]) {\n\n    case \"start\":\n        daemon.start();\n        break;\n\n    case \"stop\":\n        daemon.stop();\n        break;\n\n    default:\n        console.log(\"Usage: [start|stop]\");\n}\n```\n\nFor more examples see `examples` folder.\n\nDocumentation\n===============\n\nDaemonize works like standard `require()` but loaded module is\nforked to work in background as a daemon.\n\nKeep in mind that `stdin`, `stdout` and `stderr` are redirected\nto `/dev/null` so any output from daemon won't display in console.\nYou need to use file for logging (ie like `/examples/advanced/app.js`).\n\nAlso any uncaught exception won't be displayed in the console,\nso `process.on(\"uncaughtException\", ...)` should be used to\nredirect output to some log file.\n\n## daemonize.setup(options)\nCreates new `Daemon` instance. Supported `options`:\n\n* `main` - main application module file to run as daemon (required); `string`\n* `name` - daemon name (default: basename of main); `string`\n* `pidfile` - pidfile path (default: `/var/run/[name].pid`); `string`\n* `user` - name or id of user (default: current); `string`\n* `group` - name or id of group (default: current); `string`\n* `umask` - file mode mask (default: 0); `number` or `string`\n* `silent` - disable printing info to console (default: `false`); `boolean`\n* `stopTimeout` - interval (ms) of daemon killing retry (default: `2s`); `number`\n* `args` - additional node runtime arguments, ie `--debug`; `array` or `string`\n* `argv` - argv for daemon (default: `process.argv.slice(2)`); `array` or `string`\n\nAll paths are resolved relative to file that uses \"daemonize\".\n\nAll commandline arguments will be passed to the child process unless\noverriden with `argv` option.\n\n## Daemon\nDaemon control class. It references controlled daemon.\n\n### Event: \"starting\"\n`function() { }`\n\nEmitted when `start()` is called and if daemon is not already running.\n\n### Event: \"started\"\n`function(pid) { }`\n\nEmitted when daemon successfully started after calling `start()`.\n\n### Event: \"running\"\n`function(pid) { }`\n\nEmitted when `start()` is called and a daemon is already running.\n\n### Event: \"stopping\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a daemon is running.\n\n### Event: \"stopped\"\n`function(pid) { }`\n\nEmitted when daemon was successfully stopped after calling `stop()`\nor `kill()`.\n\n### Event: \"notrunning\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a deamon is not running.\n\n### Event: \"error\"\n`function(error) { }`\n\nEmitted when `start()` failed. `error` is instance of `Error`.\n`error.message` contains information what went wrong.\n\n### daemon.start([listener])\nStart daemon asynchronously. Emits `running` in case when daemon is\nalready running and `starting` when daemon is not running. Then emits\n`started` when daemon is successfully started.\n\nOptional `listener` callback is once called on `running`, `started` or `error`\nevent. The callback gets two arguments `(err, pid)`.\n\nEmits `error` in case of any problem during daemon startup.\n\n### daemon.stop([listener])\nAsynchronously stop daemon. Sends `SIGTERM` to daemon every 2s (or time\nset in options).\n\nEmits `notrunning` when daemon is not running, otherwise\nemits `stopping` and then `stopped` when daemon successfully stopped.\n\nOptional `listener` callback is once called on `notrunning`, `stopped` or\n`error` event. The callback gets two arguments `(err, pid)`.\n\n### daemon.kill([listener])\nKill daemon asynchronously. Sends `SIGTERM` and after 2s `SIGKILL` to the\nchild if needed. Repeats sending `SIGKILL` every 2s untill daemon\nstops (interval can be changed in options).\n\nEmits events same as `stop()`.\n\nOptional `listener` callback is same as `stop`.\n\n### daemon.status()\nSynchronously returns pid for running daemon or 0 when daemon is not running.\n\n### daemon.sendSignal(signal)\nSynchronously sends `signal` to daemon and returns pid of daemon or 0 when\ndaemon is not running.\n\n\nChangelog\n===========\n\nDaemonize is maintained under the [Semantic Versioning]\n(https://github.com/niegowski/semver/blob/master/semver.md)\nguidelines.\n\n### 0.4.1 - Jun 09 2013\n  - split `args` and `argv` on whitespaces\n  - added `umask` option\n\n### 0.4.0 - Jun 05 2013\n  - added argv option\n\n### 0.4.0-rc.6 - Nov 28 2012\n  - args option to enable node arguments ie --debug\n  - fix for: Wrapper seems to eat one argument\n\n### 0.4.0-rc.5 - Aug 28 2012\n  - Wrapper is transparent now\n\n### 0.4.0-rc.4 - Aug 16 2012\n  - The callback for start, stop and kill handles errors\n\n### 0.4.0-rc.3 - Aug 14 2012\n  - Optional callback argument for start, stop and kill\n\n### 0.4.0-rc.2 - Jul 29 2012\n  - Passing command line arguments to child process\n\n### 0.4.0-rc.1 - Jul 29 2012\n  - Daemonize forked as Daemonize2 for Node 0.8.x compatibility\n  - Removed native module for setsid - using child_process.spawn detached\n  - Passing options via ipc instead of command line arguments\n  - Rethrowing wrapper exceptions via ipc\n\n### 0.3.2 - Jul 29 2012\n  - Daemonize is compatible only with Node 0.6.x\n\n### 0.3.1 - Apr 2 2012\n\n### 0.3.0 - Jan 29 2012\n  - Daemon emits Events instead of console.log()\n  - API change - events in place of callbacks\n\n### 0.2.2 - Jan 27 2012\n  - root priviledges no longer required\n  - changed error exit codes\n  - try to remove pidfile on daemon stop\n  - configurable timeouts for start monitoring and killing\n  - closing FD-s on daemon start\n  - better examples\n\n### 0.2.1 - Jan 26 2012\n  - fix for calling callback in stop/kill when process is not running\n\n### 0.2.0 - Jan 26 2012\n  - code refactor\n  - stop listening for uncaughtException\n  - logfile removed\n\n### 0.1.2 - Jan 25 2012\n  - fixed stdout, stderr replacement\n  - checking for daemon main module presence\n  - signals change (added custom signals)\n  - better log messages\n  - gracefull terminate in example app\n  - close logfile on process exit\n\n### 0.1.1 - Jan 24 2012\n  - print stacktrace for uncaughtException\n\n### 0.1.0 - Jan 24 2012\n  - First release\n\n\nLicense\n=========\n\n(The MIT License)\n\nCopyright (c) 2012 Kuba Niegowski\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","readmeFilename":"README.md","_id":"daemonize2@0.4.1","dist":{"shasum":"49048e10cbc5aec2b767a7fe0ffe3dc43a93bace","tarball":"https://registry.npmjs.org/daemonize2/-/daemonize2-0.4.1.tgz","integrity":"sha512-0ShVMGP+c35LSQV7cswbMPgiM3AQNV4SOaYddHBaCIqpYnF2/AjhKp+xQsjYUhTkiphC9aqtrbtI4x1q68y81A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC4kkQzIkl1Ir9CsR56GhlOONoXR1a9CuXkiXgmcjIkYAiAQf3Cap9ixIWKmciY3T8COniHR5OllOeE4bbBL75zALA=="}]},"_npmVersion":"1.2.0","_npmUser":{"name":"niegowski","email":"kuba@niegowski.pl"},"maintainers":[{"name":"niegowski","email":"kuba@niegowski.pl"}]},"0.4.2":{"name":"daemonize2","version":"0.4.2","description":"Module for easy creation of daemons for Node 0.8.x","author":{"name":"Kuba Niegowski"},"contributors":[],"homepage":"https://github.com/niegowski/node-daemonize2/","keywords":["daemon"],"engines":{"node":">0.8.x"},"main":"./lib/daemonize.js","readme":"About\n=======\n\nNode module for easy creation of daemons for Node 0.8.x and above.\n\nFor Node 0.6.x compatibility see daemonize https://github.com/niegowski/node-daemonize\n\nJust write your daemon as plain node.js application\n(like `/examples/simple/app.js`) and a simple controller with Daemonize\n(like `/examples/simple/ctrl.js`).\n\n\nInstallation\n==============\n```\n$ npm install daemonize2\n```\n\n\nExample\n=========\n\n``` js\nvar daemon = require(\"daemonize2\").setup({\n    main: \"app.js\",\n    name: \"sampleapp\",\n    pidfile: \"sampleapp.pid\"\n});\n\nswitch (process.argv[2]) {\n\n    case \"start\":\n        daemon.start();\n        break;\n\n    case \"stop\":\n        daemon.stop();\n        break;\n\n    default:\n        console.log(\"Usage: [start|stop]\");\n}\n```\n\nFor more examples see `examples` folder.\n\nDocumentation\n===============\n\nDaemonize works like standard `require()` but loaded module is\nforked to work in background as a daemon.\n\nKeep in mind that `stdin`, `stdout` and `stderr` are redirected\nto `/dev/null` so any output from daemon won't display in console.\nYou need to use file for logging (ie like `/examples/advanced/app.js`).\n\nAlso any uncaught exception won't be displayed in the console,\nso `process.on(\"uncaughtException\", ...)` should be used to\nredirect output to some log file.\n\n## daemonize.setup(options)\nCreates new `Daemon` instance. Supported `options`:\n\n* `main` - main application module file to run as daemon (required); `string`\n* `name` - daemon name (default: basename of main); `string`\n* `pidfile` - pidfile path (default: `/var/run/[name].pid`); `string`\n* `user` - name or id of user (default: current); `string`\n* `group` - name or id of group (default: current); `string`\n* `umask` - file mode mask (default: 0); `number` or `string`\n* `silent` - disable printing info to console (default: `false`); `boolean`\n* `stopTimeout` - interval (ms) of daemon killing retry (default: `2s`); `number`\n* `args` - additional node runtime arguments, ie `--debug`; `array` or `string`\n* `argv` - argv for daemon (default: `process.argv.slice(2)`); `array` or `string`\n\nAll paths are resolved relative to file that uses \"daemonize\".\n\nAll commandline arguments will be passed to the child process unless\noverriden with `argv` option.\n\n## Daemon\nDaemon control class. It references controlled daemon.\n\n### Event: \"starting\"\n`function() { }`\n\nEmitted when `start()` is called and if daemon is not already running.\n\n### Event: \"started\"\n`function(pid) { }`\n\nEmitted when daemon successfully started after calling `start()`.\n\n### Event: \"running\"\n`function(pid) { }`\n\nEmitted when `start()` is called and a daemon is already running.\n\n### Event: \"stopping\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a daemon is running.\n\n### Event: \"stopped\"\n`function(pid) { }`\n\nEmitted when daemon was successfully stopped after calling `stop()`\nor `kill()`.\n\n### Event: \"notrunning\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a deamon is not running.\n\n### Event: \"error\"\n`function(error) { }`\n\nEmitted when `start()` failed. `error` is instance of `Error`.\n`error.message` contains information what went wrong.\n\n### daemon.start([listener])\nStart daemon asynchronously. Emits `running` in case when daemon is\nalready running and `starting` when daemon is not running. Then emits\n`started` when daemon is successfully started.\n\nOptional `listener` callback is once called on `running`, `started` or `error`\nevent. The callback gets two arguments `(err, pid)`.\n\nEmits `error` in case of any problem during daemon startup.\n\n### daemon.stop([listener])\nAsynchronously stop daemon. Sends `SIGTERM` to daemon every 2s (or time\nset in options).\n\nEmits `notrunning` when daemon is not running, otherwise\nemits `stopping` and then `stopped` when daemon successfully stopped.\n\nOptional `listener` callback is once called on `notrunning`, `stopped` or\n`error` event. The callback gets two arguments `(err, pid)`.\n\n### daemon.kill([listener])\nKill daemon asynchronously. Sends `SIGTERM` and after 2s `SIGKILL` to the\nchild if needed. Repeats sending `SIGKILL` every 2s untill daemon\nstops (interval can be changed in options).\n\nEmits events same as `stop()`.\n\nOptional `listener` callback is same as `stop`.\n\n### daemon.status()\nSynchronously returns pid for running daemon or 0 when daemon is not running.\n\n### daemon.sendSignal(signal)\nSynchronously sends `signal` to daemon and returns pid of daemon or 0 when\ndaemon is not running.\n\n\nChangelog\n===========\n\nDaemonize is maintained under the [Semantic Versioning]\n(https://github.com/niegowski/semver/blob/master/semver.md)\nguidelines.\n\n### 0.4.2 - Jun 09 2013\n  - update node version dependency\n\n### 0.4.1 - Jun 09 2013\n  - split `args` and `argv` on whitespaces\n  - added `umask` option\n\n### 0.4.0 - Jun 05 2013\n  - added argv option\n\n### 0.4.0-rc.6 - Nov 28 2012\n  - args option to enable node arguments ie --debug\n  - fix for: Wrapper seems to eat one argument\n\n### 0.4.0-rc.5 - Aug 28 2012\n  - Wrapper is transparent now\n\n### 0.4.0-rc.4 - Aug 16 2012\n  - The callback for start, stop and kill handles errors\n\n### 0.4.0-rc.3 - Aug 14 2012\n  - Optional callback argument for start, stop and kill\n\n### 0.4.0-rc.2 - Jul 29 2012\n  - Passing command line arguments to child process\n\n### 0.4.0-rc.1 - Jul 29 2012\n  - Daemonize forked as Daemonize2 for Node 0.8.x compatibility\n  - Removed native module for setsid - using child_process.spawn detached\n  - Passing options via ipc instead of command line arguments\n  - Rethrowing wrapper exceptions via ipc\n\n### 0.3.2 - Jul 29 2012\n  - Daemonize is compatible only with Node 0.6.x\n\n### 0.3.1 - Apr 2 2012\n\n### 0.3.0 - Jan 29 2012\n  - Daemon emits Events instead of console.log()\n  - API change - events in place of callbacks\n\n### 0.2.2 - Jan 27 2012\n  - root priviledges no longer required\n  - changed error exit codes\n  - try to remove pidfile on daemon stop\n  - configurable timeouts for start monitoring and killing\n  - closing FD-s on daemon start\n  - better examples\n\n### 0.2.1 - Jan 26 2012\n  - fix for calling callback in stop/kill when process is not running\n\n### 0.2.0 - Jan 26 2012\n  - code refactor\n  - stop listening for uncaughtException\n  - logfile removed\n\n### 0.1.2 - Jan 25 2012\n  - fixed stdout, stderr replacement\n  - checking for daemon main module presence\n  - signals change (added custom signals)\n  - better log messages\n  - gracefull terminate in example app\n  - close logfile on process exit\n\n### 0.1.1 - Jan 24 2012\n  - print stacktrace for uncaughtException\n\n### 0.1.0 - Jan 24 2012\n  - First release\n\n\nLicense\n=========\n\n(The MIT License)\n\nCopyright (c) 2012 Kuba Niegowski\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","readmeFilename":"README.md","_id":"daemonize2@0.4.2","dist":{"shasum":"c6e474078becfa7d7a814002514c4712f64fe06f","tarball":"https://registry.npmjs.org/daemonize2/-/daemonize2-0.4.2.tgz","integrity":"sha512-dzB3qdxvcJ2AWyESI8xv90qZ4wZt4P+lvQUT1sVKcrbEKSvBk/8zkDlZvMyaWmoKe7DXLGu00z59b7K9gkzbqQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFlo5LhRgE4Y5CbjyMiK0s7DapEauTYBWWbHzZBbIaN3AiEAwQMwTQB7Ifkbf8yJpRPeeHNk0md0hPjHwsq9+lSVI34="}]},"_npmVersion":"1.2.0","_npmUser":{"name":"niegowski","email":"kuba@niegowski.pl"},"maintainers":[{"name":"niegowski","email":"kuba@niegowski.pl"}]}},"readme":"About\n=======\n\nNode module for easy creation of daemons for Node 0.8.x\n\nFor Node 0.6.x compatibility see daemonize https://github.com/niegowski/node-daemonize\n\nJust write your daemon as plain node.js application \n(like `/examples/simple/app.js`) and a simple controller with Daemonize \n(like `/examples/simple/ctrl.js`). \n\n\nInstallation\n==============\n```\n$ npm install daemonize\n```\n\n\nExample\n=========\n\n``` js\nvar daemon = require(\"daemonize\").setup({\n    main: \"app.js\",\n    name: \"sampleapp\",\n    pidfile: \"sampleapp.pid\"\n});\n\nswitch (process.argv[2]) {\n    \n    case \"start\": \n        daemon.start().once(\"started\", function() {\n            process.exit();\n        });\n        break;\n    \n    case \"stop\":\n        daemon.stop();\n        break;\n    \n    default:\n        console.log(\"Usage: [start|stop]\");\n}\n```\n\nFor more examples see `examples` folder.\n\nDocumentation\n===============\n\nDaemonize works like standard `require()` but loaded module is \nforked to work in background as a daemon. \n\nKeep in mind that `stdin`, `stdout` and `stderr` are redirected \nto `/dev/null` so any output from daemon won't display in console. \nYou need to use file for logging (ie like `/examples/advanced/app.js`).\n\nAlso any uncaught exception won't be displayed in the console,\nso `process.on(\"uncaughtException\", ...)` should be used to\nredirect output to some log file.\n\n## daemonize.setup(options)\nCreates new `Daemon` instance. Supported `options`:\n\n* `main` - main application module file to run as daemon (required)\n* `name` - daemon name (default: basename of main)\n* `pidfile` - pidfile path (default: `/var/run/[name].pid`)\n* `user` - name or id of user (default: current)\n* `group` - name or id of group (default: current)\n* `silent` - disable printing info to console (default: `false`)\n* `stopTimeout` - interval of daemon killing retry (default: `2s`)\n\nAll paths are resolved relative to file that uses \"daemonize\".\n\nAll other options will be passed to the child process as posix style \narguments (`--myarg1=abc`).\n\n## Daemon\nDaemon control class. It references controlled daemon.\n\n### Event: \"starting\"\n`function() { }`\n\nEmitted when `start()` is called and if daemon is not already running.\n\n### Event: \"started\"\n`function(pid) { }`\n\nEmitted when daemon successfully started after calling `start()`.\n\n### Event: \"running\"\n`function(pid) { }`\n\nEmitted when `start()` is called and a daemon is already running.\n\n### Event: \"stopping\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a daemon is running.\n\n### Event: \"stopped\"\n`function(pid) { }`\n\nEmitted when daemon was successfully stopped after calling `stop()` \nor `kill()`.\n\n### Event: \"notrunning\"\n`function() { }`\n\nEmitted when `stop()` or `kill()` is called and a deamon is not running.\n\n### Event: \"error\"\n`function(error) { }`\n\nEmitted when `start()` failed. `error` is instance of `Error`. \n`error.message` contains information what went wrong.\n\n### daemon.start()\nStart daemon asynchronously. Emits `running` in case when daemon is \nalready running and `starting` when daemon is not running. Then emits \n`started` when daemon is successfully started. \n\nEmits `error` in case of any problem during daemon startup.\n\n### daemon.stop()\nAsynchronously stop daemon. Sends `SIGTERM` to daemon every 2s (or time \nset in options). \n\nEmits `notrunning` when daemon is not running, otherwise \nemits `stopping` and then `stopped` when daemon successfully stopped. \n\n### daemon.kill()\nKill daemon asynchronously. Sends `SIGTERM` and after 2s `SIGKILL` to the \nchild if needed. Repeats sending `SIGKILL` every 2s untill daemon \nstops (interval can be changed in options).\n\nEmits events same as `stop()`.\n\n### daemon.status()\nSynchronously returns pid for running daemon or 0 when daemon is not running.\n\n### daemon.sendSignal(signal)\nSynchronously sends `signal` to daemon and returns pid of daemon or 0 when\ndaemon is not running.\n\n\nChangelog\n===========\n\nDaemonize is maintained under the [Semantic Versioning]\n(https://github.com/niegowski/semver/blob/master/semver.md) \nguidelines.\n\n### 0.4.0-rc.1 - Jul 29 2012\n  - Daemonize forked as Daemonize2 for Node 0.8.x compatibility\n  - Removed native module for setsid - using child_process.spawn detached\n  - Passing options via ipc instead of command line arguments\n  - Rethrowing wrapper exceptions via ipc\n\n### 0.3.2 - Jul 29 2012\n  - Daemonize is compatible only with Node 0.6.x\n\n### 0.3.1 - Apr 2 2012\n\n### 0.3.0 - Jan 29 2012\n  - Daemon emits Events instead of console.log()\n  - API change - events in place of callbacks\n\n### 0.2.2 - Jan 27 2012\n  - root priviledges no longer required\n  - changed error exit codes\n  - try to remove pidfile on daemon stop\n  - configurable timeouts for start monitoring and killing\n  - closing FD-s on daemon start\n  - better examples\n\n### 0.2.1 - Jan 26 2012\n  - fix for calling callback in stop/kill when process is not running\n\n### 0.2.0 - Jan 26 2012\n  - code refactor\n  - stop listening for uncaughtException\n  - logfile removed\n\n### 0.1.2 - Jan 25 2012\n  - fixed stdout, stderr replacement\n  - checking for daemon main module presence\n  - signals change (added custom signals)\n  - better log messages\n  - gracefull terminate in example app\n  - close logfile on process exit\n\n### 0.1.1 - Jan 24 2012\n  - print stacktrace for uncaughtException\n\n### 0.1.0 - Jan 24 2012\n  - First release \n\n\nLicense\n=========\n\n(The MIT License)\n\nCopyright (c) 2012 Kuba Niegowski\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","maintainers":[{"name":"niegowski","email":"kuba@niegowski.pl"}],"time":{"modified":"2022-06-14T08:13:52.704Z","created":"2012-07-29T15:55:08.657Z","0.4.0-rc.1":"2012-07-29T15:55:10.541Z","0.4.0-rc.2":"2012-07-29T16:46:39.833Z","0.4.0-rc.3":"2012-08-14T20:15:03.953Z","0.4.0-rc.4":"2012-08-16T08:39:56.590Z","0.4.0-rc.5":"2012-08-27T22:42:05.649Z","0.4.0-rc.6":"2012-11-28T21:46:58.226Z","0.4.0":"2013-06-05T20:59:40.421Z","0.4.1":"2013-06-09T15:44:30.258Z","0.4.2":"2013-06-09T16:31:14.686Z"},"author":{"name":"Kuba Niegowski"},"users":{"fgribreau":true,"f124275809":true}}