![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
daemon-control
Advanced tools
This package offers an easy and quick to use tool to manage the control script for a daemon as well a lot of ways to deeply configure control script behaviour for each step.
var dc = require('daemon-control');
function daemon(daemonized) {
}
dc(daemon, 'daemon.pid');
$ node daemon.js {start|stop|restart|status|nodaemon|help[|reload]} [...]
A complete example can be found in sources @github.
With npm:
$ npm install --save daemon-control
require('daemon-control');
Returns DaemonControl constructor.
Extends events.EventEmitter. It manages the steps to control the daemon.
Note: Events are emitted only on control scrip.
Emitted when an error occurr.
Returns a new DaemonControl object to control the daemon, parses command line arguments and tries to act as requested by command line.
The daemon entry point.
The path of the pidfile.
If any other option is present, it is proxied to [child_process.spawn] (https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).
If not specified control script acts with its default behaviour. Can be used to customized one or more steps. Each hook is a Function which accept a done Function as first parameter which must be called at the end of the customized hook.
Functions done accept a Boolean verbose parameter as first parameter, if set to true default messages are printed to console, otherwise the hook can print custom messages to console and call done with verbose parameter set to false.
If true the reload command line parameter will be enabled. This means the deamon must be aware it can receive a SIGHUP.
The timeout (in seconds) before sending SIGKILL to daemon, if SIGTERM is not enough to stop it.
Called when there is syntax error in command line.
Called when help is requested from command line.
Called to parse command line. By default done is called with command and argv passed to this hook.
When command line is parsed, done must be called with the command in input (or null if a syntax error is detected) and the argv that will be passed to daemon command line.
Called when a status check is performed. Can be used to perform deeper checks on daemon to discover if it is running correctly. If accordingly to these checks the daemon is not running, done must be called with pid parameter set to null, otherwise with the value passed to the hook.
Called before sending SIGTERM to daemon. This hook is not called if daemon is not running.
Called before sending SIGKILL to daemon. This hook is not called if SIGTERM was enough to stop the daemon.
Called after daemon is stopped.
Called before daemon launch attempt. This is the latest occasion to customize the options Object (if this is required) before passing it to done Function.
Called after daemon launch attempt. This is called reguardless if daemon was started correctly or not in order to give access to the ChildProcess Object.
Called when start is requested from command line and the daemon is already running.
Called before sending SIGHUP to daemon. If Pid is null this hook has just to print an error message to console.
Called once per second while waiting for deamon to exit after a SIGTERM have been sent to it. Usefull to customize the output to console of one dot per second.
$ node daemon.js {start|stop|restart|status|nodaemon|help[|reload]} [...]
The first parameter is consumed by control script, from second one to last one (if present) they are passed to the daemon.
The package checks for the pidfile, if it exists its content is read and if it is an Integer the package checks for process with that pid; if this process exists the daemon is running.
A status check is performet, if the daemon is not running the pakage tries to lauch it.
A status check is performed, if the daemon is running the pakage tries to stop it.
A status check is performed, if the daemon is running the pakage tries to stop it. Once this process is completed, the package tries to launch the daemon.
The help message is printed to console.
A status check is performed, if the daemon is running the pakage sends it a SIGHUP. If reload option was false when constructor was called, this command is not enabled and it cause a syntax error.
The Function daemon is launched without running a daemon. Usefull during application development.
This package is written following Node.js 4.2 specifications always taking care about backward compatibility. The package it tested under several Node.js versions.
Note: required Node.js 0.11.
Note: tested only under UNIX.
Do not hesitate to report any bug or inconsistency @github.
FAQs
Daemon control script with pidfile management utility
The npm package daemon-control receives a total of 12 weekly downloads. As such, daemon-control popularity was classified as not popular.
We found that daemon-control demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.