eCAL Rec CLI
eCAL Rec CLI is the Command Line eCAL Rec Host Application (i.e. a replacement for eCAl Rec GUI).
The binary is ecal_rec /.exe
. eCAL Rec CLI can be used both with single-shot parameters, as well as from an interactive console.
When using an interactive console, the application will not exit automatically, but accept commands from STDIN.
Just like eCAL rec GUI, the CLI application can:
- Load, create and save
.ecalrec
configuration files - Create local and distributed recordings
Additional to those features, eCAL Rec CLI has three modes:
-
Direct mode (default): By default, eCAL Rec CLI will load a config and execute commands by itself. It will just act as a normal eCAL Rec Host application.
-
Remote-control mode: The remote control mode can by activated by passing the
--remote-control
parameter. When starting eCAL Rec CLI in remote-control mode, it will not execute commands by itself, but relay them to another eCAL Rec Host applicaiton (i.e. an eCAL Rec GUI or an eCAL Rec CLI running in direct + interactive mode). This mode is usefull, if you e.g. want to use the GUI, but still want to automatically trigger a recording in certain events.Both eCAL Rec GUI and eCAL Rec CLI (in non-remote-control mode) can be remote-controlled.
-
Interactive mode: The interactive mode can be activated by passing the
--interactive
parameter. When in interactive mode, eCAL Rec CLI will keep running and start an interactive console, where you can type additional commands.The interactive mode and remote-control mode can be used simultaneously.
Usage
1USAGE:2
3 ecal_rec [-c <Path>] [--no-default] [--remote-control] [--remote-host4 <Hostname>] [-r <Seconds>] [--savebuffer] [-x] [--activate]5 [--deactivate] [--comment [MeasID] <Comment>] [--delete6 <MeasID>] [--upload [MeasID]] [-s] [--meas-status <MeasID>]7 [--client-status <Hostname>] [--get-config] [--set-client8 <Hostname:Hosts,To,Record>] ... [--set-addons <Hostname:List9 ,Of,Addon,IDs>] ... [--remove-client <Hostname>] ... [-b10 <Seconds>] [--blacklist <List>] [--whitelist <List>] [-d11 <Path>] [-n <Directory>] [--max-file-size <megabytes>]12 [--description <String>] [--ftp-server <FTP_Server>]13 [--enable-one-file-per-topic <yes/no>]14 [--delete-after-upload <yes/no>] [-i]15 [--interactive-dont-exit] [--] [--version] [-h]16
17
18Where:19
20 -c <Path>, --config <Path>21 The configuration file to load.22
23 --no-default24 Prevent creating a default config, when no config file is loaded. This25 prevents having a default root-dir, meas-name and localhost recorder.26 Not applicable in remote-control mode.27
28 --remote-control29 Remote control another eCAL Rec host application.30
31 --remote-host <Hostname>32 Set the hostname for remote-controlling.33
34 -r <Seconds>, --record <Seconds>35 Start a new recording. If a duration in seconds is provided, the36 recording will be stopped after that time. Otherwise, it will keep37 running until stopped by the user or a succeeding stop-recording38 call.39
40 --savebuffer41 Save the content of the pre-buffer as its own recording. Only42 available in remote-control mode.43
44 -x, --stop45 Stop the currently running recording. Only available in remote-control46 mode.47
48 --activate49 Activate the recorder and all clients.50
51 --deactivate52 Deactivates the recorder and all clients.53
54 --comment [MeasID] <Comment>55 Adds a comment to a measurement. If no ID is given, the comment is56 added to the last measurement. When your intention is to comment a57 measurement started with -r (--record), you should leave out the58 MeasID or set it to 0.59
60 --delete <MeasID>61 Delete a measurement from the host and all clients.62
63 --upload64 Upload the given measurement. If no measurement ID is provided, all65 measurements will be uploaded. When -r (--record) is provided with a66 duration, the mesasurement will be uploaded after the recorder has67 finished the measurement. As a recorder may still be flushing, a small68 delay (1s) is introduced before uploading in this case. Use69 interactive mode, if this is not sufficient.70
71 -s, --status72 Print the status of a remote-controlled recorder.73
74 --meas-status <MeasID>75 Print the status of the given measurement. Only available in76 remote-control mode.77
78 --client-status <Hostname>79 Print the status of the given recorder client. Only available in80 remote-control mode.81
82 --get-config83 Print the configuration of the recorder to the console.84
85 --set-client <Hostname:Hosts,To,Record> (accepted multiple times)86 Sets which hosts shall be recorded by the given client. Use the syntax87 "Hostname:Host,To,Record". For instance, to let PC1 record itself and88 PC2, use "PC1:PC1,PC2". If no tailing list is provided, the client89 will record topcis from all hosts by default. If a configuration file90 is being loaded, this will override the setting from the config. Not91 available in remote-control mode.92
93 --set-addons <Hostname:List,Of,Addon,IDs> (accepted multiple times)94 Sets the addons that the given client shall enable. Use the syntax95 "Hostname:List,Of,Addon,IDs". You can only set enabled addons for96 clients that have already been added; i.e. the client will not be97 added automatically. If no tailing list of addon IDs is provided, all98 addons will be disabled. If a configuration file is being loaded, this99 will override the setting from the config. Not available in100 remote-control mode.101
102 --remove-client <Hostname> (accepted multiple times)103 Removes the given client. If the client had any addons enabled, those104 are removed as well. Not available in remote-control mode.105
106 -b <Seconds>, --pre-buffer <Seconds>107 Pre-buffer data for some seconds. To turn off pre-buffering, provide a108 value <= 0.0. If a configuration file is being loaded, this will109 override the setting from the config. Not available in remote-control110 mode.111
112 --blacklist <List>113 Record all topics except the listed ones (Comma separated list, e.g.:114 "Topic1,Topic2"). If a configuration file is being loaded, this will115 override the setting from the config. Not available in remote-control116 mode.117
118 --whitelist <List>119 Only record these topics (Comma separated list, e.g.: "Topic1120 ,Topic2"). If a configuration file is being loaded, this will override121 the setting from the config. Not available in remote-control mode.122
123 -d <Path>, --meas-root-dir <Path>124 Root dir used for recording when -r (--record) is set. If a125 configuration file is being loaded, this will override the setting126 from the config. Not available in remote-control mode.127
128 -n <Directory>, --meas-name <Directory>129 Name of the measurement, when -r (--record) is set. This will create a130 folder in the directory provided by -d (--meas-root-dir). If a131 configuration file is being loaded, this will override the setting132 from the config. Not available in remote-control mode.133
134 --max-file-size <megabytes>135 Maximum file size of the recording files, when -r (--record) is set.136 If a configuration file is being loaded, this will override the137 setting from the config. Not available in remote-control mode.138
139 --description <String>140 Description stored in the measurement folder, when -r (--record) is141 set. If a configuration file is being loaded, this will override the142 setting from the config. Not available in remote-control mode.143
144 --enable-one-file-per-topic <yes/no>145 Whether to separate each topic in HDF5 file. This helps faster file146 transfer and less network congestion in case of interest of specific147 topics only.148
149 --ftp-server <FTP_Server>150 The server where to upload to when uploading a measurement. Use151 "internal" for the integrated FTP Server. When using an external FTP152 Server, provide it in the following form:153 ftp://USERNAME:PASSWORD@HOSTNAME:PORT/path/to/root_dir. If a154 configuration file is being loaded, this will override the setting155 from the config. Not available in remote-control mode.156
157 --delete-after-upload <yes/no>158 Whether to delete the local measurement files after they have been159 uploaded to an FTP server. If a configuration file is being loaded,160 this will override the setting from the config. Not available in161 remote-control mode.162
163 -i, --interactive164 Start eCAL Rec and listen for commands on stdin. When not in165 remote-control mode itself, eCAL Rec will offer the eCAL Rec Service166 for being remote-controlled. Note that eCAL Rec will exit, when stdin167 is closed. To prevent that, combine this option with168 (--interactive-dont-exit).169
170 --interactive-dont-exit171 When in interactive mode, this option prevents eCAL Rec from exiting,172 when stdin is closed.173
174 --, --ignore_rest175 Ignores the rest of the labeled arguments following this flag.176
177 --version178 Displays version information and exits.179
180 -h, --help181 Displays usage information and exits.
Interactive mode
You can activate the interactivate mode by passing the --interactive
parameter on command line.
Instead of exiting eCAL rec will then go to an interactive console that lets you control it interactively by typing in commands.
If you want to remote-control eCAL Rec CLI with another eCAL Rec CLI instance, you also have to set it to interactive mode, just to prevent it from shutting down prematurely.
1load <Path>2 Loads an eCAL Rec configuration file.3
4
5save <Path>6 Saves the current configuration to a file. Not available in remote-control7 mode.8
9
10getconfig11 Prints the configuration of the recorder.12
13
14setconfig [--set-client <Hostname:Hosts,To,Record>] ...15 | [--set-addons <Hostname:List,Of,Addon,IDs>] ...16 | [--remove-client <Hostname>] ...17 | [--pre-buffer <Seconds>]18 | [--blacklist <list>]19 | [--whitelist <List>]20 | [--meas-root-dir <Path>]21 | [--meas-name <String>]22 | [--max-file-size <Megabytes>]23 | [--description <String>]24 | [--enable-one-file-per-topic <yes/no>]25 | [--ftp-server <FTP_Server>]26 | [--delete-after-upload <yes/no>]27 | [--enable-built-in-client <yes/no>]28 | [--help]29 | <> ...30 Sets a config parameter. Not available in remote-control mode. Multiple31 configuration settings can be changed with a single command. Tip: A more32 extensive help is available by --help.33
34
35activate36 Activates the recorder and all clients. If Pre-buffering is enabled, all37 recorders will start to buffer data.38
39
40deactivate41 Deactivates all clients. They keep running but will not subscribe to any42 channels and buffer data until activated again.43
44
45rec [Seconds]46 Starts a recording. If SECS_TO_RECORD is given, the recording will be stopped47 afterwards.48
49
50savebuffer51 Saves the content of the current pre-buffer to its own measurement.52
53
54stop55 Stops the current recording.56
57
58status [--meas <MeasID>] | [--host <Hostname>]59 Prints the recorder status. If no argument is provided, the recorder status,60 job history and client list ist printed. To get more detailed information,61 provide the measurement ID or hostname. The --meas and --host specifiers can62 be omitted, if the given measurement id / hostname is unique.63
64
65comment [MeasID] <Comment>66 Adds a comment to a measurement. If no ID is given, the comment will be added67 to the last measurement.68
69
70upload [MeasID]71 Uploads a measurement. If no ID is given, all measurements that can be72 uploaded will be uploaded.73
74
75delete <MeasID>76 Deletes the given measurement from all machines.77
78
79sleep <Seconds>80 Sleeps for the given amount of time. Usefull when automatically piping input81 to eCAL Rec via stdin.82
83
84exit85 Quit eCAL Rec
Automatize eCAL Rec CLI
You can use the ecal_rec interactive mode to automatize it via STDIN.
Commands are read line-by-line, i.e. they have to be divided by \n
.
Semicolons do not work.
The most concise would probably be to write all your commands in a text file and pipe the content of that to ecal_rec.
Let’s look at some examples. The examples will load a config, create a 5 seconds measurement, upload it, print the current status and exit.
-
Ubuntu:
Terminal window # Commands from command line:printf "rec 5 \n sleep 1 \n upload \n sleep 1 \n status" | ecal_rec -c ~/tutorial.ecalrec --interactive# Commands from a file:cat commands.txt | ecal_rec -c ~/tutorial.ecalrec --interactive -
Windows CMD.exe:
Terminal window rem Commands from command line:(echo rec 5 & echo sleep 1 & echo upload & echo sleep 1 & echo status) | ecal_rec -c tutorial.ecalrec --interactiverem Commands from a file:more commands.txt | ecal_rec -c tutorial.ecalrec --interactive -
Windows PowerShell:
Terminal window # Commands from command line:echo "rec 5 `n sleep 1 `n upload `n sleep 1 `n status" | ecal_rec -c tutorial.ecalrec --interactive# Commands from a file:cat commands.txt | ecal_rec -c tutorial.ecalrec --interactive