slashed / daemon.node Goto Github PK
View Code? Open in Web Editor NEWA node.JS addon that helps to create *nix daemons in Javascript
A node.JS addon that helps to create *nix daemons in Javascript
Daemon Addon for Node.js To build this module, type: > node-waf configure build For more examples, read here: http://slashed.posterous.com/writing-daemons-in-javascript-with-nodejs-0
Ok, this is a tough one, but I hope you can give me some hints. :)
I have an embedded ARM device that reserves four ttyS* devices in /dev;
~$ ls -al /dev/ttyS?
crw-rw---- 1 root dialout 4, 64 Jul 5 14:34 /dev/ttyS0
crw-rw---- 1 root dialout 4, 65 Jul 5 08:03 /dev/ttyS1
crw-rw---- 1 root dialout 4, 66 Jul 5 08:03 /dev/ttyS2
crw-rw---- 1 root dialout 4, 67 Jul 5 08:03 /dev/ttyS3
I have two different PCMCIA / CF cards that provide a serial port. Inserting one of these cards enables /dev/ttyS0.
Having the card inserted I run the following program:
require("daemon").start();
console.log("daemon mode ok");
var fs = require("fs");
setInterval(function() {
console.log("alive.");
}, 1000);
fs.open("/dev/ttyS0", "r", 0666, function(err, fd) {
if (err) {
console.log("open() failed: ",err.message);
} else {
console.log("open() OK");
}
});
The "alive." line is written continously until I remove the CF card. Then the Node.JS process dies silently.
Note the /dev/ttyS0 device file is there at all times. It changes it's mtime, though.
Node does not crash when the device is not open or when Node runs in foreground (not using the daemon
plugin).
Do you have any idea what could be causing this? Especially, why does daemon
make a difference here?
$ node -v
v0.4.8
$ uname -a
Linux nomad 2.6.26.7-sdg #15 Wed Sep 30 15:32:44 EDT 2009 armv5tel unknown
daemon.node looks great, but it'd be even better if it were installable using npm: http://npmjs.org/
Having an npm package for daemon.node would make it possible for my own apps to pull it in as a dependency seamlessly without requiring the user to hunt it down and install it, which is a must for me.
I encountered an issue where a new pid might be shorter than the previous pid. What happens is the lock file gets written with the new PID, but there are trailing digits from the previous one, so when you try to stop the application, it fails.
I fixed this by changing the code that writes the PID to pad up to PID_MAXLEN (which is defined as 10). That way, no matter how short the pid is, it will add trailing spaces up to PID_MAXLEN characters, and there won't be any digits leftover from the previous PID.
Original post: https://github.com/nodejitsu/haibu/issues/23
Reposting here as it's daemon.node that's having trouble...
I'm getting the following error when trying to run bin/haibu-server (via both npm install & git clone + npm link):
scott@scott:~$ haibu-server
node.js:183
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: /usr/local/lib/node_modules/haibu/node_modules/daemon/build/default/daemon.node: undefined symbol: ev_rt_now
at Object..node (module.js:472:11)
at Module.load (module.js:339:31)
at Function._load (module.js:298:12)
at require (module.js:367:19)
at Object. (/usr/local/lib/node_modules/haibu/node_modules/daemon/lib/daemon.js:10:15)
at Module._compile (module.js:427:26)
at Object..js (module.js:466:10)
at Module.load (module.js:339:31)
at Function._load (module.js:298:12)
at require (module.js:367:19)
I can confirm that this is an issue with node v0.3.0:
Any thoughts here? We run on both Ubuntu (production) and OSX (development) environments, so we need a cross-platform solution.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.