To avoid callback hell and weird tricks, async module is recommended.
Example:
var exec = require("child_process").exec;
Person | |
.find({ occupation: /host/ }) | |
.where('name.last').equals('Ghost') | |
.where('age').gt(17).lt(66) | |
.where('likes').in(['vaporizing', 'talking']) | |
.limit(10) | |
.sort('-occupation') | |
.select('name occupation') |
Process with pid 15061 still not killed, retrying... | |
Process with pid 15061 killed | |
Starting execution sequence in -cluster mode- for app name:AXM-REVERSE-INTERACTION id:4 | |
App name:AXM-REVERSE-INTERACTION id:4 online | |
AssertionError: false == true | |
at SharedHandle.remove (cluster.js:84:3) | |
at EventEmitter.<anonymous> (cluster.js:331:18) | |
at EventEmitter.emit (events.js:107:17) | |
at ChildProcess.<anonymous> (cluster.js:301:15) | |
at ChildProcess.g (events.js:199:16) |
[AXM-REVERSE-INTERACTION-4 (err)] Error: channel closed | |
[AXM-REVERSE-INTERACTION-4 (err)] at process.target.send (child_process.js:413:26) | |
[AXM-REVERSE-INTERACTION-4 (err)] at SyncWriteStream.write (/root/.nvm/v0.11.13/lib/node_modules/pm2/lib/ProcessContainer.js:120:45) | |
[AXM-REVERSE-INTERACTION-4 (err)] at Console.warn (console.js:61:16) | |
[AXM-REVERSE-INTERACTION-4 (err)] at /var/www/km-api/source/app_reverse_interaction/app.js:134:22 | |
[AXM-REVERSE-INTERACTION-4 (err)] at RedisClient.<anonymous> (/var/www/km-api/source/node_modules/node-redis-pubsub/lib/node-redis-pubsub.js:55:7) | |
[AXM-REVERSE-INTERACTION-4 (err)] at RedisClient.EventEmitter.emit (events.js:118:17) | |
[AXM-REVERSE-INTERACTION-4 (err)] at RedisClient.return_reply (/var/www/km-api/source/node_modules/node-redis-pubsub/node_modules/redis/index.js:675:22) | |
[AXM-REVERSE-INTERACTION-4 (err)] at ReplyParser.<anonymous> (/var/www/km-api/source/node_modules/node-redis-pubsub/node_modules/redis/index.js:312:14) | |
[AXM-REVERSE-IN |
[AXM-INTERACTION-APP-2 (err)] r.db("EglRAuP2gK0im1s").table("status").insert({data: {process: [{pid: 26932, name: "server", interpreter: "node", restart_time: 133, created_at: 1413536942741, exec_mode: "fork_mode", pm_uptime: 1414015830592, status: "online", pm_id: 0, cpu: 0, memory: 69808128, versioning: {type: "git", revision: "d04b231e72cff5335aa3da7342be5a9131580754", url: "[email protected]:code-press/cp-images.git", update_time: "2014-10-17T09:08:45.000Z", comment: "back enabled", branch: "master"}, axm_actions: [], axm_monitor: {}, axm_dynamic: {}}], server: {loadavg: [0, 0.00244140625, 0], total_mem: 1038848000, free_mem: 308981760, cpu: {number: 1, info: "Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz"}, hostname: "images", uptime: 2056629.186766907, type: "Linux", platform: "linux", arch: "x64", interaction: false, pm2_version: "0.11.1", remote_port: 53326, remote_ip: "23.253.22.75"}, active: true}, server_name: "images", created_at: r.ISO8601("2014-10-22T22:35:59.782Z"), updated_at: r.ISO8601("2014-10-22T22 |
2014-10-23 07:44 -04:00: { [RqlRuntimeError: Database `iLyv0TE4UFIZtXI` does not exist in: | |
[AXM-INTERACTION-APP-2 (err)] r.db("iLyv0TE4UFIZtXI").table("status").insert({data: {process: [], server: {loadavg: [0.19580078125, 0.103515625, 0.08642578125], total_mem: 1073741824, free_mem: 698847232, cpu: [{model: "AMD Opteron(tm) Processor 6386 SE ", speed: 3100, times: {user: 32928800, nice: 17300, sys: 35156900, idle: 16061034200, irq: 0}}], hostname: "vps100792.ovh.net", uptime: 1622155.739417096, type: "Linux", platform: "linux", arch: "x64", interaction: false, pm2_version: "0.11.1", remote_port: 55260, remote_ip: "5.196.14.22"}, active: true}, server_name: "centosDrinkup", created_at: r.ISO8601("2014-10-23T11:44:25.723Z"), updated_at: r.ISO8601("2014-10-23T11:44:25.723Z")}, {conflict: "replace"}) | |
[AXM-INTERACTION-APP-2 (err)] ^^^^^^^^^^^^^^^^^^^^^^^ |
Proc is not defined anymore or is being killed | |
TypeError: Cannot read property 'pid' of null | |
at null._onTimeout (/home/shant/keymetrics/pm2/lib/God/ActionMethods.js:224:39) | |
at Timer.listOnTimeout (timers.js:133:15) |
==> /home/shant/.pm2/pm2.log <== | |
TypeError: Cannot read property 'exitCode' of null | |
at Worker.isDead (cluster.js:68:22) | |
at ChildProcess.<anonymous> (cluster.js:369:18) | |
at ChildProcess.g (events.js:199:16) | |
at ChildProcess.emit (events.js:104:17) | |
at finish (child_process.js:534:14) | |
at process._tickCallback (node.js:372:11) |
Starting execution sequence in -fork mode- for app name:custom_action id:11 | |
App name:custom_action id:11 online | |
Unlocking 12 | |
TypeError: Cannot read property 'exitCode' of null | |
at Worker.isDead (cluster.js:68:22) | |
at ChildProcess.<anonymous> (cluster.js:369:18) | |
at ChildProcess.g (events.js:199:16) | |
at ChildProcess.emit (events.js:104:17) | |
at finish (child_process.js:534:14) | |
at process._tickCallback (node.js:372:11) |
/home/shant/keymetrics/pm2/lib/Monit.js:231 | |
this.bars[proc.pm_id].cpu.percent(0, proc.pm2_env.status.red); | |
^ | |
TypeError: Cannot read property 'cpu' of undefined | |
at Object.Monit.updateBars (/home/shant/keymetrics/pm2/lib/Monit.js:231:26) | |
at Object.Monit.refresh (/home/shant/keymetrics/pm2/lib/Monit.js:118:12) | |
at /home/shant/keymetrics/pm2/lib/CLI.js:1298:13 | |
at /home/shant/keymetrics/pm2/node_modules/pm2-axon-rpc/lib/client.js:45:10 | |
at Parser.<anonymous> (/home/shant/keymetrics/pm2/node_modules/pm2-axon/lib/sockets/req.js:67:8) | |
at Parser.emit (events.js:107:17) |