github.com/hy3/cuto@v0.9.8-0.20160830082821-aa6652f877b7/README.md (about) 1 # GoCuto 2 3 ![banner](_resource/logo-yoko.png) 4 5 GoCuto is a process control tool that can execute cross-server processes in the order you like. 6 7 ![system_image](_resource/cutoimage.png) 8 9 ## Installation 10 11 Download binary packages on [GoCuto Official Website](http://cuto.unirita.co.jp/cuto/). 12 13 Or, build GoCoto with go command. (need Go 1.4 or higher) 14 15 go get github.com/unirita/cuto/master 16 go get github.com/unirita/cuto/servant 17 go get github.com/unirita/cuto/show 18 19 20 ## Commands 21 22 ### Master 23 24 Master command executes group of processes (called Jobnet). 25 Use this command when you want to run Jobnet. 26 27 master -n JobnetName -s -c /path/to/master.ini 28 29 **Options** 30 31 |Option |Description | 32 |-------------|-----------------------------------------------------------------------------------------------| 33 |-v |Show version information | 34 |-n JobnetName|Set name of Jobnet | 35 |-s |Use this option if you want to run Jobnet. If didn't, master command only checks Jobnet syntax.| 36 |-c FilePath |Set file path of master.ini | 37 38 ### Servant 39 40 Servant command is a resident process which executes processes by request from the Master. 41 You must run this command every server to use Master command. 42 43 servant -c /path/to/servant.ini 44 45 **Options** 46 47 |Option |Description | 48 |-------------|----------------------------| 49 |-v |Show version information | 50 |-c FilePath |Set file path of servant.ini| 51 52 ### Show 53 54 Show command is a viewer for Jobnet execution result. 55 56 show -c /path/to/master.ini [options] 57 58 **Options** 59 60 |Option |Description | 61 |--------------------|-----------------------------------------------------------------------------| 62 |-v |Show version information | 63 |-help |Show usage | 64 |-c FilePath |Set file path of master.ini | 65 |-jobnet JobnetName |Narrow result by Jobnet | 66 |-nid InstanceID |Narrow result by Instance ID (unique ID for every execution) | 67 |-from Date, -to Date|Narrow result by range of executed date | 68 |-status Status |Narrow result by status (select from "normal", "abnormal", "warn", "running")| 69 |-format Format |Select output format from "json" or "csv" | 70 |-utc |Set or show date value as UTC timezone, not as local timezone | 71 72 73 ## Configuration 74 75 GoCuto uses some configuration files written by [toml format](https://github.com/toml-lang/toml). 76 77 ### master.ini 78 79 master.ini is configuration file for Master command. 80 81 **Tables and Keys** 82 83 |Table|Key |Type |Description | 84 |-----|----------------------|-------|-------------------------------------------------------------------------------------| 85 |job |default_node |String |Host name of default node which Job (process) is executed on. | 86 |job |default_port |Integer|Port number of default node which Job is executed on. | 87 |job |default_timeout_min |Integer|Default time limit to wait end of Job execution. (minute) | 88 |job |connection_timeout_sec|Integer|Time limit to wait connection keep alive signal. (second) | 89 |job |time_tracking_span_min|Integer|Time span to display elapsed time from execution started time. (minute) | 90 |job |attempt_limit |Integer|Max retry number of times when Job is not able to start. | 91 |dir |jobnet_dir |String |Directory to put Jobnet definition files in. | 92 |dir |log_dir |String |Directory to output Master command log files. | 93 |dir |db_dir |String |Directory to put execution result db file in. | 94 |log |output_level |String |Minimum log level. Select from "trace", "debug", "info", "warn", "error", "critical".| 95 |log |max_size_kb |Integer|Max size of log file. (KByte) | 96 |log |max_generation |Integer|Max generation for log file rotation. | 97 |log |timeout_sec |Integer|Time limit to wait log output ends. | 98 99 ### servant.ini 100 101 master.ini is configuration file for Servant command. 102 103 **Tables and Keys** 104 105 |Table|Key |Type |Description | 106 |-----|------------------|-------|-------------------------------------------------------------------------------------| 107 |sys |bind_address |String |Listen host name of servant. | 108 |sys |bind_port |Integer|Listen port number of servant. | 109 |job |multi_proc |Integer|Max number of Job execution at same time. | 110 |job |heartbeat_span_sec|Integer|Time span to send keep alive signal for master. (second) | 111 |dir |job_dir |String |Directory to put files be executed as Job in. | 112 |dir |joblog_dir |String |Directory to output Job log files. | 113 |dir |log_dir |String |Directory to output Servant command log files. | 114 |log |output_level |String |Minimum log level. Select from "trace", "debug", "info", "warn", "error", "critical".| 115 |log |max_size_kb |Integer|Max size of log file. (KByte) | 116 |log |max_generation |Integer|Max generation for log file rotation. | 117 |log |timeout_sec |Integer|Time limit to wait log output ends. | 118 119 ## Jobnet definition 120 121 ### Flow definition. 122 123 Create Jobnet Flow file as [BPMN 2.0](http://www.omg.org/spec/BPMN/2.0/) XML format. 124 125 **Available tags** 126 127 |Tag name |Description | 128 |---------------|--------------------------------------| 129 |ServiceTask |Corresponds with a Job. | 130 |ParallelGateway|Signifies start or end of branch flow.| 131 |StartEvent |Signifies entry point. | 132 |EndEvent |Signifies exit point. | 133 |SequenceFlow |Connects two nodes. | 134 135 **Example** 136 137 If you want to design this flow, 138 139 ![system_image](_resource/sample_flow.jpg) 140 141 Create flow file, like this. 142 143 <?xml version="1.0" encoding="UTF-8"?> 144 <Definitions> 145 <Process> 146 <StartEvent id="start"/> 147 <EndEvent id="end"/> 148 <ServiceTask id="job1" name="job1.bat"/> 149 <ServiceTask id="job2" name="job2.bat"/> 150 <ServiceTask id="job3" name="job3.bat"/> 151 <ParallelGateway id="gateway1"/> 152 <ParallelGateway id="gateway2"/> 153 <SequenceFlow sourceRef="start" targetRef="job1"/> 154 <SequenceFlow sourceRef="job1" targetRef="gateway1"/> 155 <SequenceFlow sourceRef="gateway1" targetRef="job2"/> 156 <SequenceFlow sourceRef="gateway1" targetRef="job3"/> 157 <SequenceFlow sourceRef="job2" targetRef="gateway2"/> 158 <SequenceFlow sourceRef="job3" targetRef="gateway2"/> 159 <SequenceFlow sourceRef="gateway2" targetRef="end"/> 160 </Process> 161 </Definitions> 162 163 ### Job detail definition 164 165 Create Job detail file as CSV format. 166 167 **CSV Columns** 168 169 | #|Column name |Description | 170 |---:|-----------------|------------------------------------------------------------------------------------| 171 | 1|Job name |Name of Job to link with ServiceTask tag in Flow file. | 172 | 2|Node name |Host name of server where to execute Job. | 173 | 3|Port number |Port number of server where to execute Job. | 174 | 4|File path |File which is executed as Job. | 175 | 5|Arguments |Command line arguments for Job. | 176 | 6|Environments |Environment variables for Job. | 177 | 7|Working directory|Working directory at execution time. | 178 | 8|RC to warn |Job is judged as warning when its RC is over this value. | 179 | 9|Output to warn |Job is judged as warning when its stdout or stderr includes this value. | 180 | 10|RC to error |ob is judged as error when its RC is over this value. | 181 | 11|Output to error |Job is judged as error when its stdout or stderr includes this value. | 182 | 12|Timeout |Time limit to wait end of Job execution. (minute) | 183 | 13|Secondary node |Host name of secondary server will be used when Job can not start at first server. | 184 | 14|Secondary port |Port number of secondary server will be used when Job can not start at first server.| 185 186 ## License 187 188 Licensed under an [GPLv2](LICENSE) license. 189 190 Copyright. (C) 2015 UNIRITA Inc,