Here is my code:
process.chdir(__dirname);
var service = require ("os-service");
var express = require('express');
var fs = require ("fs");
var serviceName = "myService";
switch (process.argv[2])
{
case ("--add"):
service.add (serviceName, {programArgs: ["--run"]}, function(error){
if (error)console.warn(error); else console.log(serviceName+" added"
);
});
break;
case ("--remove"):
service.remove (serviceName, function(error){
if (error)console.warn(error); else console.log(serviceName+"
removed");
});
break;
case ("--run"):
var logStream = fs.createWriteStream (serviceName + ".log");
service.run (logStream, function () {
service.stop (0);
});
// appliation code
setInterval (function () {
console.log (new Date ().toString ());
}, 1000);
break;
}
---------------------------------------------------------------
All works fine from console (in Windows): --add, --remove, --run .. no
problem at all.
However, starting the added service from the Windows service manager fails,
unfortunately!
To get it running as a service, I have to remove the line "var express =
require('express');"
Something does not work together between express and os-service?
Express was installed using "npm install express".
Matthias
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/f456b663-dc71-4c59-b2a0-000d83d8c5b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.