How to use
- Fill in App name, Script, Instances, Restart above MB for Pm2file.
- To match “Two instances and a 300 MB cap”, enter App name web; Script server.js; Instances 2; Restart above MB 300.
- Press Generate PM2 file. The summary line should be “Pm2file: web runs server.js × 2, restart after 300M”.
- Read every line under “Pm2file: web runs server.js × 2, restart after 300M” before you copy the Pm2file result.
- Press Copy for the whole Pm2file result, or Reset to restore “Two instances and a 300 MB cap”.
- For the second check, “One worker”, the summary should be “Pm2file: jobs runs worker.js × 1, restart after 512M”.
Formula / how it works
Example “Two instances and a 300 MB cap” sets App name = web; Script = server.js; Instances = 2; Restart above MB = 300.
Pm2file returns this exact text:
Pm2file: web runs server.js × 2, restart after 300M
---
{
"apps": [
{
"name": "web",
"script": "server.js",
"instances": 2,
"max_memory_restart": "300M"
}
]
}
max_memory_restart uses an M suffix.
Example “One worker” sets App name = jobs; Script = worker.js; Instances = 1; Restart above MB = 512.
Pm2file returns this exact text:
Pm2file: jobs runs worker.js × 1, restart after 512M
---
{
"apps": [
{
"name": "jobs",
"script": "worker.js",
"instances": 1,
"max_memory_restart": "512M"
}
]
}
A different script name.
Pm2file vocabulary for this page: pm2, instances, memory, script, restart, pm2file.
Pm2file pass 1 (“One worker”) prints:
Pm2file: jobs runs worker.js × 1, restart after 512M
---
{
"apps": [
{
"name": "jobs",
"script": "worker.js",
"instances": 1,
"max_memory_restart": "512M"
}
]
}
The words for this pass are pm2, instances, memory, script, restart, pm2file.
Pm2file pass 2 (“Two instances and a 300 MB cap”) prints:
Pm2file: web runs server.js × 2, restart after 300M
---
{
"apps": [
{
"name": "web",
"script": "server.js",
"instances": 2,
"max_memory_restart": "300M"
}
]
}
The words for this pass are pm2, instances, memory, script, restart, pm2file.
Pm2file pass 3 (“One worker”) prints:
Pm2file: jobs runs worker.js × 1, restart after 512M
---
{
"apps": [
{
"name": "jobs",
"script": "worker.js",
"instances": 1,
"max_memory_restart": "512M"
}
]
}
The words for this pass are pm2, instances, memory, script, restart, pm2file.
Pm2file pass 4 (“Two instances and a 300 MB cap”) prints:
Pm2file: web runs server.js × 2, restart after 300M
---
{
"apps": [
{
"name": "web",
"script": "server.js",
"instances": 2,
"max_memory_restart": "300M"
}
]
}
The words for this pass are pm2, instances, memory, script, restart, pm2file.
Worked examples
Two instances and a 300 MB cap
Inputs: App name: web | Script: server.js | Instances: 2 | Restart above MB: 300
Set App name web, then Script server.js, then Instances 2, then Restart above MB 300. Press Generate PM2 file. The Pm2file summary should read “Pm2file: web runs server.js × 2, restart after 300M”.
Result: Pm2file: web runs server.js × 2, restart after 300M
---
{
"apps": [
{
"name": "web",
"script": "server.js",
"instances": 2,
"max_memory_restart": "300M"
}
]
}
max_memory_restart uses an M suffix.
One worker
Inputs: App name: jobs | Script: worker.js | Instances: 1 | Restart above MB: 512
Set App name jobs, then Script worker.js, then Instances 1, then Restart above MB 512. Press Generate PM2 file. The Pm2file summary should read “Pm2file: jobs runs worker.js × 1, restart after 512M”.
Result: Pm2file: jobs runs worker.js × 1, restart after 512M
---
{
"apps": [
{
"name": "jobs",
"script": "worker.js",
"instances": 1,
"max_memory_restart": "512M"
}
]
}
A different script name.
Use cases
- Check “Pm2file: web runs server.js × 2, restart after 300M” before trusting a new Pm2file input.
- Check “Pm2file: jobs runs worker.js × 1, restart after 512M” as the second Pm2file case.
- max_memory_restart uses an M suffix.
- A different script name.
Tips & limitations
- “Two instances and a 300 MB cap”: max_memory_restart uses an M suffix.
- “One worker”: A different script name.
- Pm2file fields: App name, Script, Instances, Restart above MB.
- The Pm2file summary for the opening example is “Pm2file: web runs server.js × 2, restart after 300M”.
FAQ
What does “Two instances and a 300 MB cap” return?
Pm2file summary: “Pm2file: web runs server.js × 2, restart after 300M”. Full result: Pm2file: web runs server.js × 2, restart after 300M --- { "apps": [ { "name": "web", "script": "server.js", "instances": 2, "max_memory_restart": "300M" } ] }
What does “One worker” return?
Pm2file summary: “Pm2file: jobs runs worker.js × 1, restart after 512M”. Full result: Pm2file: jobs runs worker.js × 1, restart after 512M --- { "apps": [ { "name": "jobs", "script": "worker.js", "instances": 1, "max_memory_restart": "512M" } ] }
Which values produce “Pm2file: web runs server.js × 2, restart after 300M”?
App name: web | Script: server.js | Instances: 2 | Restart above MB: 300
Which values produce “Pm2file: jobs runs worker.js × 1, restart after 512M”?
App name: jobs | Script: worker.js | Instances: 1 | Restart above MB: 512
How is “Pm2file: web runs server.js × 2, restart after 300M” different from “Pm2file: jobs runs worker.js × 1, restart after 512M”?
“Two instances and a 300 MB cap” gives “Pm2file: web runs server.js × 2, restart after 300M”. “One worker” gives “Pm2file: jobs runs worker.js × 1, restart after 512M”.
What does Pm2file include in the full first result?
Pm2file: web runs server.js × 2, restart after 300M --- { "apps": [ { "name": "web", "script": "server.js", "instances": 2, "max_memory_restart": "300M" } ] }
Runs entirely in your browser; nothing is uploaded. Check the output before you rely on it in production code, data or security decisions.