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

Merged
merged 1 commit into from Jan 30, 2014

Projects

None yet

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 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