-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restart process with name will restart unexpected processes. #558
Comments
Quoting for ease: I agree that it should only test the "name" not the path basename. I had this issue once and had to use God.findByName = function(name) {
var db = God.clusters_db;
var arr = [];
for (var key in db) {
if (God.clusters_db[key].pm2_env.name == name) {
arr.push(db[key]);
}
}
return arr;
}; @Unitech thoughts? If we wanted to "restart by path" the check should be done on the whole path like this to be accurate: God.clusters_db[key].pm2_env.pm_exec_path == name |
It was just a convenient way for beginners to restart their scripts. I didn't got so many complaints about this "feature", so if someone else complain about it, we will patch this |
I thought about that a bit, and we could change it so So |
And what if my name contains a "/"? Stupid but might lead to another issue ^^:
|
This would start an application with the name If someone intentionally names his app |
Just use
But user may use the
The code will be God.clusters_db[key].pm2_env.pm_exec_path == path.resolve(name) ||
God.clusters_db[key].pm2_env.name == name How about this solution? :) |
pm2 restart path|scriptname
command exists for a long time, recently I found some issues with this command, for example:I have a node service (and others) named 'striker' on my server, the startup script is something like '/usr/local/repos/striker/bin/striker', and I deployed two version of this script, which one is 'release' versions and another is 'general availability' version.
When I start these two service with pm2, it works well.
When I restart the release version by name,
pm2 restart striker
, it will restart both two scripts unexpected.I found this issue was caused by 'God/Methods.findByName' function. I wonder how many people will use
restart
command with path or script name. So I removedfind by path/script name
infindByName
function, just keep it simple and clear. What's your opinion?Cheers!
The text was updated successfully, but these errors were encountered: