Skip to content
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

Added the ability to accept JSON via a pipe from standard input. #273

Merged
merged 1 commit into from
Jan 30, 2014
Merged

Added the ability to accept JSON via a pipe from standard input. #273

merged 1 commit into from
Jan 30, 2014

Conversation

vwal
Copy link
Contributor

@vwal vwal commented Jan 30, 2014

Added the ability to pipe JSON in. This is useful specifically when using Fabric to manage remote servers running pm2, as this way the JSON which is already available for the control script can simply be piped in without having to transfer a separate JSON file to the remote. Used the UNIX-standard hyphen to indicate an stdinput stream. Does not interfere with other command line options. Now something like this is possible (e.g. in bash):

#!/bin/bash

read -d '' my_json <<_EOF_ 
[{
    "name"       : "app1",
    "script"     : "/home/projects/pm2_nodetest/app.js",
    "instances"  : "4",
    "error_file" : "./logz/child-err.log",
    "out_file"   : "./logz/child-out.log",
    "pid_file"   : "./logz/child.pid",
    "exec_mode"  : "cluster_mode",
    "port"       : 4200
}]
_EOF_

echo $my_json | pm2 start -

Unitech added a commit that referenced this pull request Jan 30, 2014
Added the ability to accept JSON via a pipe from standard input.
@Unitech Unitech merged commit 4ceb4a6 into Unitech:master Jan 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants