@zappinginc/zm2 6.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/.claude/settings.local.json +8 -0
  2. package/.gitattributes +4 -0
  3. package/.mocharc.js +14 -0
  4. package/CHANGELOG.md +2416 -0
  5. package/CLAUDE.md +84 -0
  6. package/CONTRIBUTING.md +124 -0
  7. package/GNU-AGPL-3.0.txt +665 -0
  8. package/LICENSE +1 -0
  9. package/README.md +248 -0
  10. package/bin/zm2 +3 -0
  11. package/bin/zm2-dev +3 -0
  12. package/bin/zm2-docker +3 -0
  13. package/bin/zm2-runtime +3 -0
  14. package/bin/zm2-windows +3 -0
  15. package/bin/zm2.ps1 +3 -0
  16. package/bun.lock +421 -0
  17. package/constants.js +114 -0
  18. package/index.js +13 -0
  19. package/lib/API/Configuration.js +212 -0
  20. package/lib/API/Containerizer.js +335 -0
  21. package/lib/API/Dashboard.js +459 -0
  22. package/lib/API/Deploy.js +117 -0
  23. package/lib/API/Extra.js +775 -0
  24. package/lib/API/ExtraMgmt/Docker.js +30 -0
  25. package/lib/API/Log.js +315 -0
  26. package/lib/API/LogManagement.js +371 -0
  27. package/lib/API/Modules/LOCAL.js +122 -0
  28. package/lib/API/Modules/Modularizer.js +148 -0
  29. package/lib/API/Modules/NPM.js +445 -0
  30. package/lib/API/Modules/TAR.js +362 -0
  31. package/lib/API/Modules/flagExt.js +46 -0
  32. package/lib/API/Modules/index.js +120 -0
  33. package/lib/API/Monit.js +247 -0
  34. package/lib/API/Serve.js +343 -0
  35. package/lib/API/Startup.js +629 -0
  36. package/lib/API/UX/helpers.js +213 -0
  37. package/lib/API/UX/index.js +9 -0
  38. package/lib/API/UX/pm2-describe.js +193 -0
  39. package/lib/API/UX/pm2-ls-minimal.js +31 -0
  40. package/lib/API/UX/pm2-ls.js +483 -0
  41. package/lib/API/Version.js +382 -0
  42. package/lib/API/interpreter.json +12 -0
  43. package/lib/API/pm2-plus/PM2IO.js +372 -0
  44. package/lib/API/pm2-plus/auth-strategies/CliAuth.js +288 -0
  45. package/lib/API/pm2-plus/auth-strategies/WebAuth.js +187 -0
  46. package/lib/API/pm2-plus/helpers.js +97 -0
  47. package/lib/API/pm2-plus/link.js +126 -0
  48. package/lib/API/pm2-plus/pres/motd +16 -0
  49. package/lib/API/pm2-plus/pres/motd.update +26 -0
  50. package/lib/API/pm2-plus/pres/welcome +28 -0
  51. package/lib/API/pm2-plus/process-selector.js +52 -0
  52. package/lib/API/schema.json +379 -0
  53. package/lib/API.js +1931 -0
  54. package/lib/Client.js +776 -0
  55. package/lib/Common.js +911 -0
  56. package/lib/Configuration.js +304 -0
  57. package/lib/Daemon.js +456 -0
  58. package/lib/Event.js +37 -0
  59. package/lib/God/ActionMethods.js +909 -0
  60. package/lib/God/ClusterMode.js +97 -0
  61. package/lib/God/ForkMode.js +297 -0
  62. package/lib/God/Methods.js +265 -0
  63. package/lib/God/Reload.js +240 -0
  64. package/lib/God.js +632 -0
  65. package/lib/HttpInterface.js +76 -0
  66. package/lib/ProcessContainer.js +305 -0
  67. package/lib/ProcessContainerBun.js +360 -0
  68. package/lib/ProcessContainerFork.js +42 -0
  69. package/lib/ProcessContainerForkBun.js +33 -0
  70. package/lib/ProcessUtils.js +55 -0
  71. package/lib/TreeKill.js +118 -0
  72. package/lib/Utility.js +430 -0
  73. package/lib/VersionCheck.js +46 -0
  74. package/lib/Watcher.js +117 -0
  75. package/lib/Worker.js +169 -0
  76. package/lib/binaries/CLI.js +1041 -0
  77. package/lib/binaries/DevCLI.js +183 -0
  78. package/lib/binaries/Runtime.js +101 -0
  79. package/lib/binaries/Runtime4Docker.js +192 -0
  80. package/lib/completion.js +229 -0
  81. package/lib/completion.sh +40 -0
  82. package/lib/motd +36 -0
  83. package/lib/templates/Dockerfiles/Dockerfile-java.tpl +7 -0
  84. package/lib/templates/Dockerfiles/Dockerfile-nodejs.tpl +8 -0
  85. package/lib/templates/Dockerfiles/Dockerfile-ruby.tpl +7 -0
  86. package/lib/templates/ecosystem-es.tpl +24 -0
  87. package/lib/templates/ecosystem-simple-es.tpl +8 -0
  88. package/lib/templates/ecosystem-simple.tpl +6 -0
  89. package/lib/templates/ecosystem.tpl +22 -0
  90. package/lib/templates/init-scripts/launchd.tpl +35 -0
  91. package/lib/templates/init-scripts/openrc.tpl +52 -0
  92. package/lib/templates/init-scripts/pm2-init-amazon.sh +86 -0
  93. package/lib/templates/init-scripts/rcd-openbsd.tpl +41 -0
  94. package/lib/templates/init-scripts/rcd.tpl +44 -0
  95. package/lib/templates/init-scripts/smf.tpl +43 -0
  96. package/lib/templates/init-scripts/systemd-online.tpl +22 -0
  97. package/lib/templates/init-scripts/systemd.tpl +22 -0
  98. package/lib/templates/init-scripts/upstart.tpl +103 -0
  99. package/lib/templates/logrotate.d/pm2 +10 -0
  100. package/lib/templates/sample-apps/http-server/README.md +14 -0
  101. package/lib/templates/sample-apps/http-server/api.js +9 -0
  102. package/lib/templates/sample-apps/http-server/ecosystem.config.js +14 -0
  103. package/lib/templates/sample-apps/http-server/package.json +11 -0
  104. package/lib/templates/sample-apps/pm2-plus-metrics-actions/README.md +45 -0
  105. package/lib/templates/sample-apps/pm2-plus-metrics-actions/custom-metrics.js +66 -0
  106. package/lib/templates/sample-apps/pm2-plus-metrics-actions/ecosystem.config.js +12 -0
  107. package/lib/templates/sample-apps/pm2-plus-metrics-actions/package.json +11 -0
  108. package/lib/templates/sample-apps/python-app/README.md +4 -0
  109. package/lib/templates/sample-apps/python-app/echo.py +7 -0
  110. package/lib/templates/sample-apps/python-app/ecosystem.config.js +12 -0
  111. package/lib/templates/sample-apps/python-app/package.json +11 -0
  112. package/lib/tools/Config.js +248 -0
  113. package/lib/tools/IsAbsolute.js +20 -0
  114. package/lib/tools/copydirSync.js +101 -0
  115. package/lib/tools/deleteFolderRecursive.js +19 -0
  116. package/lib/tools/find-package-json.js +74 -0
  117. package/lib/tools/fmt.js +72 -0
  118. package/lib/tools/isbinaryfile.js +94 -0
  119. package/lib/tools/json5.js +752 -0
  120. package/lib/tools/open.js +63 -0
  121. package/lib/tools/passwd.js +58 -0
  122. package/lib/tools/promise.min.js +1 -0
  123. package/lib/tools/sexec.js +55 -0
  124. package/lib/tools/treeify.js +113 -0
  125. package/lib/tools/which.js +120 -0
  126. package/lib/tools/xdg-open +861 -0
  127. package/package.json +219 -0
  128. package/paths.js +93 -0
  129. package/pm2 +11 -0
  130. package/preinstall.js +24 -0
  131. package/run.sh +9 -0
  132. package/types/index.d.ts +722 -0
  133. package/types/tsconfig.json +14 -0
@@ -0,0 +1,213 @@
1
+ const chalk = require('ansis')
2
+ const Helpers = {}
3
+
4
+ /**
5
+ * Converts Byte to Human readable size
6
+ * @method bytesToSize
7
+ * @param {} bytes
8
+ * @param {} precision
9
+ * @return
10
+ */
11
+ Helpers.bytesToSize = function(bytes, precision) {
12
+ var kilobyte = 1024
13
+ var megabyte = kilobyte * 1024
14
+ var gigabyte = megabyte * 1024
15
+ var terabyte = gigabyte * 1024
16
+
17
+ if ((bytes >= 0) && (bytes < kilobyte)) {
18
+ return bytes + 'b '
19
+ } else if ((bytes >= kilobyte) && (bytes < megabyte)) {
20
+ return (bytes / kilobyte).toFixed(precision) + 'kb '
21
+ } else if ((bytes >= megabyte) && (bytes < gigabyte)) {
22
+ return (bytes / megabyte).toFixed(precision) + 'mb '
23
+ } else if ((bytes >= gigabyte) && (bytes < terabyte)) {
24
+ return (bytes / gigabyte).toFixed(precision) + 'gb '
25
+ } else if (bytes >= terabyte) {
26
+ return (bytes / terabyte).toFixed(precision) + 'tb '
27
+ } else {
28
+ return bytes + 'b '
29
+ }
30
+ }
31
+
32
+
33
+ /**
34
+ * Color Process state
35
+ * @method colorStatus
36
+ * @param {} status
37
+ * @return
38
+ */
39
+ Helpers.colorStatus = function(status) {
40
+ switch (status) {
41
+
42
+ case 'online':
43
+ return chalk.green.bold('online')
44
+ break
45
+ case 'running':
46
+ return chalk.green.bold('online')
47
+ break
48
+ case 'restarting':
49
+ return chalk.yellow.bold('restart')
50
+ break
51
+ case 'created':
52
+ return chalk.yellow.bold('created')
53
+ break
54
+ case 'launching':
55
+ return chalk.blue.bold('launching')
56
+ break
57
+ default:
58
+ return chalk.red.bold(status)
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Safe Push
64
+ */
65
+ Helpers.safe_push = function() {
66
+ var argv = arguments
67
+ var table = argv[0]
68
+
69
+ for (var i = 1; i < argv.length; ++i) {
70
+ var elem = argv[i]
71
+ if (elem[Object.keys(elem)[0]] === undefined
72
+ || elem[Object.keys(elem)[0]] === null) {
73
+ elem[Object.keys(elem)[0]] = 'N/A'
74
+ }
75
+ else if (Array.isArray(elem[Object.keys(elem)[0]])) {
76
+ elem[Object.keys(elem)[0]].forEach(function(curr, j) {
77
+ if (curr === undefined || curr === null)
78
+ elem[Object.keys(elem)[0]][j] = 'N/A'
79
+ })
80
+ }
81
+ table.push(elem)
82
+ }
83
+ }
84
+
85
+ /**
86
+ * Description
87
+ * @method timeSince
88
+ * @param {} date
89
+ * @return BinaryExpression
90
+ */
91
+ Helpers.timeSince = function(date) {
92
+ var seconds = Math.floor((new Date() - date) / 1000)
93
+
94
+ var interval = Math.floor(seconds / 31536000)
95
+
96
+ if (interval > 1) {
97
+ return interval + 'Y'
98
+ }
99
+ interval = Math.floor(seconds / 2592000)
100
+ if (interval > 1) {
101
+ return interval + 'M'
102
+ }
103
+ interval = Math.floor(seconds / 86400)
104
+ if (interval > 1) {
105
+ return interval + 'D'
106
+ }
107
+ interval = Math.floor(seconds / 3600)
108
+ if (interval > 1) {
109
+ return interval + 'h'
110
+ }
111
+ interval = Math.floor(seconds / 60)
112
+ if (interval > 1) {
113
+ return interval + 'm'
114
+ }
115
+ return Math.floor(seconds) + 's'
116
+ }
117
+
118
+ /**
119
+ * Colorize Metrics
120
+ *
121
+ * @param {Number} value current value
122
+ * @param {Number} warn value threshold
123
+ * @param {Number} alert value threshold
124
+ * @param {String} prefix value prefix
125
+ * @return {String} value
126
+ */
127
+ Helpers.colorizedMetric = function(value, warn, alert, prefix) {
128
+ var inverted = false
129
+ if (alert < warn)
130
+ inverted = true
131
+
132
+ if (!prefix) prefix = ''
133
+ if (isNaN(value) === true)
134
+ return 'N/A'
135
+ if (value == 0)
136
+ return 0 + prefix
137
+ if (inverted == true) {
138
+ if (value > warn)
139
+ return chalk.green(value + prefix)
140
+ if (value <= warn && value >= alert)
141
+ return chalk.bold.yellow(value + prefix)
142
+ return chalk.bold.red(value + prefix)
143
+ }
144
+ if (value < warn)
145
+ return chalk.green(value + prefix)
146
+ if (value >= warn && value <= alert)
147
+ return chalk.bold.yellow(value + prefix)
148
+ return chalk.bold.red(value + prefix)
149
+ }
150
+
151
+ /**
152
+ * Get nested property
153
+ *
154
+ * @param {String} propertyName
155
+ * @param {Object} obj
156
+ * @returns {String} property value
157
+ */
158
+ Helpers.getNestedProperty = function(propertyName, obj) {
159
+ var parts = propertyName.split('.'),
160
+ length = parts.length,
161
+ property = obj || {}
162
+
163
+ for (var i = 0; i < length; i++ ) {
164
+ property = property[parts[i]]
165
+ }
166
+
167
+ return property
168
+ }
169
+
170
+ Helpers.openEditor = function (file, opts, cb) {
171
+ var spawn = require('child_process').spawn
172
+
173
+ if (typeof opts === 'function') {
174
+ cb = opts
175
+ opts = {}
176
+ }
177
+
178
+ if (!opts) opts = {}
179
+
180
+ var ed = /^win/.test(process.platform) ? 'notepad' : 'vim'
181
+ var editor = opts.editor || process.env.VISUAL || process.env.EDITOR || ed
182
+ var args = editor.split(/\s+/)
183
+ var bin = args.shift()
184
+
185
+ var ps = spawn(bin, args.concat([ file ]), {
186
+ windowsHide: true,
187
+ stdio: 'inherit'
188
+ })
189
+
190
+ ps.on('exit', function (code, sig) {
191
+ if (typeof cb === 'function') cb(code, sig)
192
+ })
193
+ }
194
+
195
+
196
+ Helpers.dispKeys = function(kv, target_module) {
197
+ Object.keys(kv).forEach(function(key) {
198
+
199
+ if (target_module != null && target_module != key)
200
+ return false
201
+
202
+ if (typeof(kv[key]) == 'object') {
203
+ var obj = {}
204
+
205
+ console.log(chalk.bold('Module: ') + chalk.bold.blue(key))
206
+ Object.keys(kv[key]).forEach(function(sub_key) {
207
+ console.log(`$ pm2 set ${key}:${sub_key} ${kv[key][sub_key]}`)
208
+ })
209
+ }
210
+ })
211
+ }
212
+
213
+ module.exports = Helpers
@@ -0,0 +1,9 @@
1
+
2
+ const UX = {
3
+ helpers: require('./helpers.js'),
4
+ describe: require('./pm2-describe.js'),
5
+ list: require('./pm2-ls.js'),
6
+ list_min: require('./pm2-ls-minimal.js')
7
+ }
8
+
9
+ module.exports = UX
@@ -0,0 +1,193 @@
1
+ const Table = require('cli-tableau')
2
+ const chalk = require('ansis')
3
+ const UxHelpers = require('./helpers.js')
4
+ const Common = require('../../Common.js')
5
+
6
+ var postModuleInfos = function(module_name, human_info) {
7
+ var table = new Table({
8
+ style : {'padding-left' : 1, head : ['cyan', 'bold'], compact : true}
9
+ })
10
+
11
+ var disp = {}
12
+
13
+ human_info.unshift(['Module name', module_name])
14
+ human_info.forEach(function(info) {
15
+ var obj = {}
16
+ obj[chalk.bold.cyan(info[0])] = info[1]
17
+ table.push(obj)
18
+ })
19
+
20
+ console.log()
21
+ console.log(chalk.bold.inverse(' Module %s infos '), module_name)
22
+ console.log(table.toString())
23
+ }
24
+
25
+ /**
26
+ * Description
27
+ * @method describeTable
28
+ * @param {Object} proc process list
29
+ */
30
+ module.exports = function(proc) {
31
+ var table = new Table({
32
+ style : {'padding-left' : 1, head : ['cyan', 'bold'], compact : true}
33
+ })
34
+
35
+ var pm2_env = proc.pm2_env
36
+
37
+ var created_at = 'N/A'
38
+
39
+ if (pm2_env.axm_options && pm2_env.axm_options.human_info) {
40
+ postModuleInfos(pm2_env.name, pm2_env.axm_options.human_info)
41
+ }
42
+
43
+ try {
44
+ if (pm2_env.created_at != null)
45
+ created_at = new Date(pm2_env.created_at).toISOString()
46
+ } catch (e) {
47
+ }
48
+
49
+ console.log(chalk.bold.inverse(' Describing process with id %d - name %s '), pm2_env.pm_id, pm2_env.name)
50
+ UxHelpers.safe_push(table,
51
+ { 'status' : UxHelpers.colorStatus(pm2_env.status) },
52
+ { 'name': pm2_env.name },
53
+ { 'namespace': pm2_env.namespace },
54
+ { 'version': pm2_env.version },
55
+ { 'restarts' : pm2_env.restart_time },
56
+ { 'uptime' : (pm2_env.pm_uptime && pm2_env.status == 'online') ? UxHelpers.timeSince(pm2_env.pm_uptime) : 0 },
57
+ { 'script path' : pm2_env.pm_exec_path },
58
+ { 'script args' : pm2_env.args ? (typeof pm2_env.args == 'string' ? JSON.parse(pm2_env.args.replace(/'/g, '"')):pm2_env.args).join(' ') : null },
59
+ { 'error log path' : pm2_env.pm_err_log_path },
60
+ { 'out log path' : pm2_env.pm_out_log_path },
61
+ { 'pid path' : pm2_env.pm_pid_path },
62
+
63
+ { 'interpreter' : pm2_env.exec_interpreter },
64
+ { 'interpreter args' : pm2_env.node_args.length != 0 ? pm2_env.node_args : null },
65
+
66
+ { 'script id' : pm2_env.pm_id },
67
+ { 'exec cwd' : pm2_env.pm_cwd },
68
+
69
+ { 'exec mode' : pm2_env.exec_mode },
70
+ { 'node.js version' : pm2_env.node_version },
71
+ { 'node env': pm2_env.env.NODE_ENV },
72
+ { 'watch & reload' : pm2_env.watch ? chalk.green.bold('✔') : '✘' },
73
+ { 'unstable restarts' : pm2_env.unstable_restarts },
74
+ { 'created at' : created_at }
75
+ )
76
+
77
+ if ('pm_log_path' in pm2_env){
78
+ table.splice(6, 0, {'entire log path': pm2_env.pm_log_path})
79
+ }
80
+
81
+ if ('cron_restart' in pm2_env){
82
+ table.splice(5, 0, {'cron restart': pm2_env.cron_restart})
83
+ }
84
+
85
+ console.log(table.toString())
86
+
87
+ /**
88
+ * Module conf display
89
+ */
90
+ if (pm2_env.axm_options &&
91
+ pm2_env.axm_options.module_conf &&
92
+ Object.keys(pm2_env.axm_options.module_conf).length > 0) {
93
+ var table_conf = new Table({
94
+ style : {'padding-left' : 1, head : ['cyan', 'bold'], compact : true}
95
+ })
96
+ console.log('Process configuration')
97
+
98
+ Object.keys(pm2_env.axm_options.module_conf).forEach(function(key) {
99
+ var tmp = {}
100
+ tmp[key] = pm2_env.axm_options.module_conf[key]
101
+ UxHelpers.safe_push(table_conf, tmp)
102
+ })
103
+
104
+ console.log(table_conf.toString())
105
+ }
106
+
107
+ /**
108
+ * Versioning metadata
109
+ */
110
+ if (pm2_env.versioning) {
111
+
112
+ var table2 = new Table({
113
+ style : {'padding-left' : 1, head : ['cyan', 'bold'], compact : true}
114
+ })
115
+
116
+ console.log(chalk.inverse.bold(' Revision control metadata '))
117
+ UxHelpers.safe_push(table2,
118
+ { 'revision control' : pm2_env.versioning.type },
119
+ { 'remote url' : pm2_env.versioning.url },
120
+ { 'repository root' : pm2_env.versioning.repo_path },
121
+ { 'last update' : pm2_env.versioning.update_time },
122
+ { 'revision' : pm2_env.versioning.revision },
123
+ { 'comment' : pm2_env.versioning.comment ? pm2_env.versioning.comment.trim().slice(0, 60) : '' },
124
+ { 'branch' : pm2_env.versioning.branch }
125
+ )
126
+ console.log(table2.toString())
127
+ }
128
+
129
+ if (pm2_env.axm_actions && Object.keys(pm2_env.axm_actions).length > 0) {
130
+ var table_actions = new Table({
131
+ style : {'padding-left' : 1, head : ['cyan', 'bold'], compact : true}
132
+ })
133
+
134
+ console.log(chalk.inverse.bold(' Actions available '))
135
+ pm2_env.axm_actions.forEach(function(action_set) {
136
+ UxHelpers.safe_push(table_actions, [action_set.action_name])
137
+ })
138
+
139
+ console.log(table_actions.toString())
140
+ Common.printOut(chalk.white.italic(' Trigger via: pm2 trigger %s <action_name>\n'), pm2_env.name)
141
+ }
142
+
143
+ if (pm2_env.axm_monitor && Object.keys(pm2_env.axm_monitor).length > 0) {
144
+ var table_probes = new Table({
145
+ style : {'padding-left' : 1, head : ['cyan', 'bold'], compact : true}
146
+ })
147
+
148
+ console.log(chalk.inverse.bold(' Code metrics value '))
149
+ Object.keys(pm2_env.axm_monitor).forEach(function(key) {
150
+ var obj = {}
151
+ var metric_name = pm2_env.axm_monitor[key].hasOwnProperty("value") ? pm2_env.axm_monitor[key].value : pm2_env.axm_monitor[key]
152
+ var metric_unit = pm2_env.axm_monitor[key].hasOwnProperty("unit") ? pm2_env.axm_monitor[key].unit : ''
153
+ var value = `${metric_name} ${metric_unit}`
154
+ obj[key] = value
155
+ UxHelpers.safe_push(table_probes, obj)
156
+ })
157
+
158
+ console.log(table_probes.toString())
159
+ }
160
+
161
+ var table_env = new Table({
162
+ style : {'padding-left' : 1, head : ['cyan', 'bold'], compact : true}
163
+ })
164
+
165
+ console.log(chalk.inverse.bold(' Divergent env variables from local env '))
166
+
167
+ var _env = Common.safeExtend({}, pm2_env)
168
+ var diff_env = {}
169
+
170
+ Object.keys(process.env).forEach(k => {
171
+ if (!_env[k] || _env[k] != process.env[k]) {
172
+ diff_env[k] = process.env[k]
173
+ }
174
+ })
175
+
176
+ Object.keys(diff_env).forEach(function(key) {
177
+ var obj = {}
178
+ if (_env[key]) {
179
+ // 1. fix env value is not a String and slice is undeinfed
180
+ // 2. fix process.stdout.columns is undefined and causes empty string output
181
+ // 3. columns defaults to 300 - same as specified in pm2-ls
182
+ obj[key] = String(_env[key]).slice(0, (process.stdout.columns || 300) - 60)
183
+ UxHelpers.safe_push(table_env, obj)
184
+ }
185
+ })
186
+
187
+ console.log(table_env.toString())
188
+ console.log()
189
+ Common.printOut(chalk.white.italic(' Add your own code metrics: http://bit.ly/code-metrics'))
190
+ Common.printOut(chalk.white.italic(' Use `pm2 logs %s [--lines 1000]` to display logs'), pm2_env.name)
191
+ Common.printOut(chalk.white.italic(' Use `pm2 env %s` to display environment variables'), pm2_env.pm_id)
192
+ Common.printOut(chalk.white.italic(' Use `pm2 monit` to monitor CPU and Memory usage'), pm2_env.name)
193
+ }
@@ -0,0 +1,31 @@
1
+
2
+ const UxHelpers = require('./helpers.js')
3
+ const p = require('path')
4
+
5
+ /**
6
+ * Minimal display via pm2 ls -m
7
+ * @method miniDisplay
8
+ * @param {Object} list process list
9
+ */
10
+ module.exports = function(list) {
11
+ list.forEach(function(l) {
12
+
13
+ var mode = l.pm2_env.exec_mode.split('_mode')[0]
14
+ var status = l.pm2_env.status
15
+ var key = l.pm2_env.name || p.basename(l.pm2_env.pm_exec_path.script)
16
+
17
+ console.log('+--- %s', key)
18
+ console.log('namespace : %s', l.pm2_env.namespace)
19
+ console.log('version : %s', l.pm2_env.version)
20
+ console.log('pid : %s', l.pid)
21
+ console.log('pm2 id : %s', l.pm2_env.pm_id)
22
+ console.log('status : %s', status)
23
+ console.log('mode : %s', mode)
24
+ console.log('restarted : %d', l.pm2_env.restart_time ? l.pm2_env.restart_time : 0)
25
+ console.log('uptime : %s', (l.pm2_env.pm_uptime && status == 'online') ? UxHelpers.timeSince(l.pm2_env.pm_uptime) : 0)
26
+ console.log('memory usage : %s', l.monit ? UxHelpers.bytesToSize(l.monit.memory, 1) : '')
27
+ console.log('error log : %s', l.pm2_env.pm_err_log_path)
28
+ console.log('watching : %s', l.pm2_env.watch ? 'yes' : 'no')
29
+ console.log('PID file : %s\n', l.pm2_env.pm_pid_path)
30
+ })
31
+ }