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

Conversation

2 participants
@vwal
Contributor

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

Merge pull request #273 from vwal/feature-accept-piped-json
Added the ability to accept JSON via a pipe from standard input.

@Unitech Unitech merged commit 4ceb4a6 into Unitech:master Jan 30, 2014

1 check passed

default The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment