Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

daemon

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

daemon

Add-on for creating *nix daemons

  • 0.3.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

daemon.node

A C++ add-on for Node.js to enable simple daemons in Javascript plus some useful wrappers in Javascript.

Installation

Installing npm (node package manager)

  curl http://npmjs.org/install.sh | sh

Installing daemon.node with npm

  [sudo] npm install daemon

Installing daemon.node locally

  node-waf configure build  

Usage

There is a great getting started article on daemons and node.js by Slashed that you can read here. The API has changed slightly from that version thanks to contributions from ptge and fugue; there is no longer a daemon.closeIO() method, this is done automatically for you.

Starting a daemon:

Starting a daemon is easy, just call daemon.start() and daemon.lock().

  var daemon = require('daemon');
  
  // Your awesome code here
  
  fs.open('somefile.log', 'w+', function (err, fd) {
    daemon.daemonize(fd);
    daemon.lock('/tmp/yourprogram.pid');
  });

This library also exposes a higher level facility through javascript for starting daemons:

  var sys = require('sys'),
      daemon = require('daemon');
  
  // Your awesome code here
  
  daemon.daemonize('somefile.log', '/tmp/yourprogram.pid', function (err, pid) {
    // We are now in the daemon process
    if (err) return sys.puts('Error starting daemon: ' + err);
    
    sys.puts('Daemon started successfully with pid: ' + pid);
  });

The Fine Print

This library is available under the MIT LICENSE. See the LICENSE file for more details. It was created by Slashed and forked / improved / hacked upon by a lot of good people. Special thanks to Isaacs for npm and a great example in [glob][6].

Author: Slashed
Contributors: Charlie Robbins, Pedro Teixeira, James Halliday, Zak Taylor, Daniel Bartlett

[6]:

FAQs

Package last updated on 11 Feb 2011

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc