PS C:\Users\ganes\OneDrive\Documents\projects\ejsondb> node index.js start
index.js daemon successfully started
(node:3616) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3616) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(node:3616) Warning: Accessing non-existent property 'version' of module exports inside circular dependency
PS C:\Users\ganes\OneDrive\Documents\projects\ejsondb> node index.js restart
index.js daemon successfully started
(node:9336) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:9336) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(node:9336) Warning: Accessing non-existent property 'version' of module exports inside circular dependency
PS C:\Users\ganes\OneDrive\Documents\projects\ejsondb> node index.js stop
(node:21424) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:21424) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(node:21424) Warning: Accessing non-existent property 'version' of module exports inside circular dependency
index.js daemon not running or user not authorized to stop process
PS C:\Users\ganes\OneDrive\Documents\projects\ejsondb>
var startStopDaemon = require('start-stop-daemon');
var http = require('http');
var server = startStopDaemon(function () {
http.createServer(function (req, res) {
console.log(req.connection.remoteAddress + ' accessed ' + req.url);
if (req.url === '/error')
throw new Error('to crash server');
res.end('Hello world! Thanks for accessing ' + req.url);
}).listen(1095);
});
server.on("error", function () { this.stdout.write("error at " + new Date() + "\n"); });
server.on("start", function () { this.stdout.write("Starting at " + new Date() + "\n"); });
server.on("stop", function () { this.stdout.write("Stop at " + new Date() + "\n"); });
server.on("restart", function () { this.stdout.write("Restarting at " + new Date() + "\n"); });
server.on("exit", function () { this.stdout.write("Exit at " + new Date() + "\n"); });
server.on("stdout", function () { this.stdout.write("Stdout at " + new Date() + "\n"); });
server.on("stderr", function () { this.stdout.write("Stderr at " + new Date() + "\n"); });
getting
index.js daemon not running or user not authorized to stop processerror when trying to stop daemonthe code i am using: