2017年1月29日日曜日

JobScheduler のXMLコマンドをcurlで実行する


JobSchedulerのOrderを登録したい場合は以下のようにします。
下記例のコマンドは、JobSchedulerEngine(ver1.10.6) をインストールしたサーバで実行しています。
[root@centos0702 sosjs]# curl -v -XPOST -d '<add_order job_chain="/test/job_chain3" at="now"/>' http://localhost:40444/jobscheduler/engine-cpp
* About to connect() to localhost port 40444 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 40444 (#0)
> POST /jobscheduler/engine-cpp HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:40444
> Accept: */*
> Content-Length: 50
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 50 out of 50 bytes
< HTTP/1.1 200 OK
< Content-Type: text/xml;charset=ISO-8859-1
< Date: Wed, 25 Jan 2017 11:26:35 GMT
< Transfer-Encoding: chunked
< Server: Jetty(8.1.16.v20140903)
<
<?xml version="1.0" encoding="ISO-8859-1"?>
<spooler>
   <answer time="2017-01-25T11:26:34.949Z">
      <ok>
         <order created="2017-01-25T11:26:34.951Z"
                id="4"
                initial_state="job01"
                job="/test/job01"
                job_chain="/test/job_chain3"
                order="4"
                path="/"
                priority="0"
                state="job01">
            <file_based state="not_initialized">
               <requisites/>
            </file_based>
         </order>
      </ok>
   </answer>
</spooler>
* Connection #0 to host localhost left intact

履歴を見る場合は以下のようにします。
[root@centos0702 sosjs]# curl -v -XPOST -d '<show_history job="/test/job01" what="job_chains"/>' http://localhost:40444/jobscheduler/engine-cpp
* About to connect() to localhost port 40444 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 40444 (#0)
> POST /jobscheduler/engine-cpp HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:40444
> Accept: */*
> Content-Length: 51
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 51 out of 51 bytes
< HTTP/1.1 200 OK
< Content-Type: text/xml;charset=ISO-8859-1
< Date: Wed, 25 Jan 2017 11:26:10 GMT
< Transfer-Encoding: chunked
< Server: Jetty(8.1.16.v20140903)
<
<?xml version="1.0" encoding="ISO-8859-1"?>
<spooler>
   <answer time="2017-01-25T11:26:10.359Z">
      <history>
         <history.entry cause="order"
                        end_time="2017-01-25T10:21:13.000Z"
                        error="0"
                        exit_code="0"
                        id="5"
                        job_name="test/job01"
                        pid="452"
                        spooler_id="scheduler"
                        start_time="2017-01-25T10:21:13.000Z"
                        steps="1"
                        task="5"/>
         <history.entry cause="order"
                        end_time="2017-01-25T10:12:28.000Z"
                        error="0"
                        exit_code="0"
                        id="4"
                        job_name="test/job01"
                        pid="449"
                        spooler_id="scheduler"
                        start_time="2017-01-25T10:12:27.000Z"
                        steps="1"
                        task="4"/>
      </history>
   </answer>
</spooler>
* Connection #0 to host localhost left intact



[参考ページ]