Skip to content

pman command: reference

Dan McPherson edited this page Aug 24, 2018 · 17 revisions

pman reference

Abstract

This page provides a simple set of copy/paste friendly commands for all the pman commands.

Preconditions

  • This page assumes that pman is listening on: 172.17.0.2:5010.
  • Make sure that pman has been started (see here for more info):
pman --rawmode 1 --http  --port 5010 --listeners 12
  • This page assumes that a previous run has been managed with parameters
{  "action": "run",
        "meta": {
                "cmd":      "cal 7 1970",
                "auid":     "rudolphpienaar",
                "jid":      "cal-job-1234",
                "threaded": true
        }
}

Reference

Start prefix

Start the purl command with

purl --verb POST --raw --http 172.17.0.2:5010/api/v1/cmd --jsonwrapper 'payload' --msg \

simple copy/paste the above line into a terminal. Do not press enter!

Message payloads

Now, copy paste one of the following into the same line (and press enter!)

get

'{  "action": "get",
        "meta": {
                "path":        "/"
        }
}
' --quiet --jsonpprintindent 4      

run

'{  "action": "run",
        "meta": {
                "cmd":      "cal 7 1970",
                "auid":     "rudolphpienaar",
                "jid":      "cal-job-1234",
                "threaded": true
        }
}'

search

'{  "action": "search",
        "meta": {
                "key":          "jid",
                "value":        "cal-job-1234",
                "job":          "0",
                "when":         "end",
                "field":        "stdout"
        }
}' --quiet --jsonpprintindent 4 

status

'{  "action": "status",
        "meta": {
                "key":          "jid",
                "value":        "cal-job-1234"
        }
}' --quiet --jsonpprintindent 4  

done

'{  "action": "done",
        "meta": {
                "key":          "jid",
                "value":        "cal-job-1234"
        }
}' --quiet --jsonpprintindent 4  

info

'{  "action": "info",
        "meta": {
                "key":          "jid",
                "value":        "cal-job-1234",
                "path":         "/"
        }
}' --quiet --jsonpprintindent 4  

quit

'{  "action": "quit",
    "meta": {
                "when":         "now",
                "saveDB":       true
            }
}' --quiet --jsonpprintindent 4

compound statements

Compound statements are a string of statements executed in series, joined via ;. In the context of pman the entire compound statement is considered a single entity; however the status of individual components is captured and returned in the end.returncode.

run

'{  "action": "run",
        "meta": {
                "cmd":      "cal 7 1970; sleep 10; cal 7 2070",
                "auid":     "rudolphpienaar",
                "jid":      "compound-cal",
                "threaded": true
        }
}' --quiet --jsonpprintindent 4

status

'{  "action": "status",
        "meta": {
                "key":          "jid",
                "value":        "compound-cal"
        }
}' --quiet --jsonpprintindent 4  

run with broken job!

'{  "action": "run",
        "meta": {
                "cmd":      "cal 7 1970; ls /home ; sleep 10 ; ls /tmp; sleep 5; cal 7 2070",
                "auid":     "rudolphpienaar",
                "jid":      "compound-cal2",
                "threaded": true
        }
}' --quiet --jsonpprintindent 4

status

'{  "action": "status",
        "meta": {
                "key":          "jid",
                "value":        "compound-cal2"
        }
}' --quiet --jsonpprintindent 4  

run with &&

'{  "action": "run",
        "meta": {
                "cmd":      "cal 7 1970 && ls /home && sleep 10 && ls /tmp && sleep 5; cal 7 2070",
                "auid":     "rudolphpienaar",
                "jid":      "compound-cal3",
                "threaded": true
        }
}' --quiet --jsonpprintindent 4

status

'{  "action": "status",
        "meta": {
                "key":          "jid",
                "value":        "compound-cal3"
        }
}' --quiet --jsonpprintindent 4  

--30--