It would have to be the one in the userDir as that is the only one that makes sense for standard installs.
Having thought about it further, this is what I think would be an excellent upgrade ...
Create/update node-red command with start, stop and restart commands.
Existing node-red-start and node-red-stop would simply be aliases for node-red start and node-red stop.
Make those commands look up the actual command to run in the userDir settings.js file.
This would allow users/admins to adapt the command to their own local installation and would allow for multiple instances of Node-RED. The default setting would simply be the existing systemd command which covers the most common installations.
It would allow easy adaptions to Windows, Mac, PM2, .... but would keep the common commands.
Add the commands to the userDir package.json
This is a nice-to-have but would mean that people familiar with using npm would be able to control things directly.
For example node-red start would result in "Did you mean node-red --start?" and the usage message.
Linux : Startup scripts called start-node-red etc to be provided by the install script which could use systemd or any other startup method.
Windows : NR startup methods seem to be a dogs breakfast on Windows anyway.
Anything else: umm...
Those [few] people on Linux who have stop.json and use node-red stop would see Did you mean start-node-red or node-red --start --flows stop.json?
Just node-red, as now, to start Node-red in the current command window with default flows file.
Incidentally, node-red -v is in the usage message but the -v seems to be ignored, as is any --unknown command line flag.
Why not - I only include that for backwards compatibility which is important.
Details Doesn't really matter, the principal is the same.
Not relavent. The point is to have a hook where the commands can be specified so that the standard start/stop/restart commands stay the same for end users. Only the CONFGURATION changes and only in one standard point.
I might have 5 different "live" Node-RED instances on a Linux server. Would the standard command work no matter what my systemd script was named? I don't believe so. I might even (heaven forbid!) want to run Node-RED under PM2 on my Linux server.
So what the commands are on Windows or Mac isn't the issue here. The fact that there is currently no way to service people with multiple instances or on two of the most popular OS's on the planet.
This is a simple problem to fix and a nice improvement.
Doesnt the fact of the first demonstrate that the second is not true?
But we can certainly agree that Node-red startup is suboptimal on all OSes known here.
On Linux there is evidence of confusion between node-red start and node-red-start.
I don't see how retaining those but changing what they do can decrease confusion. For new users maybe. But they seem increasingly to be using Windows.
Some people understand the difference and use them appropriately. As Dave suggests, they may be using node-red start with a flows file called start.
I don't think backwards compatibility (at least in the startup command) is all that important for these folk. They know what they are doing.
It would, perhaps be less confusing if they both did the same thing which is what I would propose. node-red --start === node-red-start === npm start
And my proposal would work fine on Windows (as a service, or using the scheduler, ...), or Mac, or on Windows WSL, BSD, or with PM2 on any platform, ....
All with the same commands.
The point actually is that it takes away confusions on how to start/stop/restart node-red. On any platform you would be able to use the same commands.
There is currently a fundamental difference between the commands node-red-start and the node-red. node-red-start starts node red running as a systemd service, using the user configured in the systemd script. node-red runs node-red directly in the current window as the current user.
Both of those methods of running must be supported.
[Edit] Should this topic be split from the MQTT thread? I would do it myself but I am not sure how to do it.
Would not using the same command for the two cases, with different command line options cause further confusion? Also, with the node-red command, one can specify, example, which flows file, settings file etc to use, but that would not be appropriate when starting it as a service, I think.
Also - currently the node-red command is actually auto created by npm install -g - so it is platform agnostic - It knows nothing about running things as services on various platforms. If things like start were added to node-red command then it would have to start the app (in order to understand the command parameter - then stop itself and restart itself as a service - this type maybe as root (having escalated privileges etc...)
hmm not sure that is wise.