Skip to content

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.

eCAL Rec CLI

Usage

rec_server_cli_usage.txt
1
USAGE:
2
3
ecal_rec [-c <Path>] [--no-default] [--remote-control] [--remote-host
4
<Hostname>] [-r <Seconds>] [--savebuffer] [-x] [--activate]
5
[--deactivate] [--comment [MeasID] <Comment>] [--delete
6
<MeasID>] [--upload [MeasID]] [-s] [--meas-status <MeasID>]
7
[--client-status <Hostname>] [--get-config] [--set-client
8
<Hostname:Hosts,To,Record>] ... [--set-addons <Hostname:List
9
,Of,Addon,IDs>] ... [--remove-client <Hostname>] ... [-b
10
<Seconds>] [--blacklist <List>] [--whitelist <List>] [-d
11
<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
18
Where:
19
20
-c <Path>, --config <Path>
21
The configuration file to load.
22
23
--no-default
24
Prevent creating a default config, when no config file is loaded. This
25
prevents having a default root-dir, meas-name and localhost recorder.
26
Not applicable in remote-control mode.
27
28
--remote-control
29
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, the
36
recording will be stopped after that time. Otherwise, it will keep
37
running until stopped by the user or a succeeding stop-recording
38
call.
39
40
--savebuffer
41
Save the content of the pre-buffer as its own recording. Only
42
available in remote-control mode.
43
44
-x, --stop
45
Stop the currently running recording. Only available in remote-control
46
mode.
47
48
--activate
49
Activate the recorder and all clients.
50
51
--deactivate
52
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 is
56
added to the last measurement. When your intention is to comment a
57
measurement started with -r (--record), you should leave out the
58
MeasID or set it to 0.
59
60
--delete <MeasID>
61
Delete a measurement from the host and all clients.
62
63
--upload
64
Upload the given measurement. If no measurement ID is provided, all
65
measurements will be uploaded. When -r (--record) is provided with a
66
duration, the mesasurement will be uploaded after the recorder has
67
finished the measurement. As a recorder may still be flushing, a small
68
delay (1s) is introduced before uploading in this case. Use
69
interactive mode, if this is not sufficient.
70
71
-s, --status
72
Print the status of a remote-controlled recorder.
73
74
--meas-status <MeasID>
75
Print the status of the given measurement. Only available in
76
remote-control mode.
77
78
--client-status <Hostname>
79
Print the status of the given recorder client. Only available in
80
remote-control mode.
81
82
--get-config
83
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 syntax
87
"Hostname:Host,To,Record". For instance, to let PC1 record itself and
88
PC2, use "PC1:PC1,PC2". If no tailing list is provided, the client
89
will record topcis from all hosts by default. If a configuration file
90
is being loaded, this will override the setting from the config. Not
91
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 syntax
95
"Hostname:List,Of,Addon,IDs". You can only set enabled addons for
96
clients that have already been added; i.e. the client will not be
97
added automatically. If no tailing list of addon IDs is provided, all
98
addons will be disabled. If a configuration file is being loaded, this
99
will override the setting from the config. Not available in
100
remote-control mode.
101
102
--remove-client <Hostname> (accepted multiple times)
103
Removes the given client. If the client had any addons enabled, those
104
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 a
108
value <= 0.0. If a configuration file is being loaded, this will
109
override the setting from the config. Not available in remote-control
110
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 will
115
override the setting from the config. Not available in remote-control
116
mode.
117
118
--whitelist <List>
119
Only record these topics (Comma separated list, e.g.: "Topic1
120
,Topic2"). If a configuration file is being loaded, this will override
121
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 a
125
configuration file is being loaded, this will override the setting
126
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 a
130
folder in the directory provided by -d (--meas-root-dir). If a
131
configuration file is being loaded, this will override the setting
132
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 the
137
setting from the config. Not available in remote-control mode.
138
139
--description <String>
140
Description stored in the measurement folder, when -r (--record) is
141
set. If a configuration file is being loaded, this will override the
142
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 file
146
transfer and less network congestion in case of interest of specific
147
topics only.
148
149
--ftp-server <FTP_Server>
150
The server where to upload to when uploading a measurement. Use
151
"internal" for the integrated FTP Server. When using an external FTP
152
Server, provide it in the following form:
153
ftp://USERNAME:PASSWORD@HOSTNAME:PORT/path/to/root_dir. If a
154
configuration file is being loaded, this will override the setting
155
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 been
159
uploaded to an FTP server. If a configuration file is being loaded,
160
this will override the setting from the config. Not available in
161
remote-control mode.
162
163
-i, --interactive
164
Start eCAL Rec and listen for commands on stdin. When not in
165
remote-control mode itself, eCAL Rec will offer the eCAL Rec Service
166
for being remote-controlled. Note that eCAL Rec will exit, when stdin
167
is closed. To prevent that, combine this option with
168
(--interactive-dont-exit).
169
170
--interactive-dont-exit
171
When in interactive mode, this option prevents eCAL Rec from exiting,
172
when stdin is closed.
173
174
--, --ignore_rest
175
Ignores the rest of the labeled arguments following this flag.
176
177
--version
178
Displays version information and exits.
179
180
-h, --help
181
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.

rec_server_cli_interactive_help.txt
1
load <Path>
2
Loads an eCAL Rec configuration file.
3
4
5
save <Path>
6
Saves the current configuration to a file. Not available in remote-control
7
mode.
8
9
10
getconfig
11
Prints the configuration of the recorder.
12
13
14
setconfig [--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. Multiple
31
configuration settings can be changed with a single command. Tip: A more
32
extensive help is available by --help.
33
34
35
activate
36
Activates the recorder and all clients. If Pre-buffering is enabled, all
37
recorders will start to buffer data.
38
39
40
deactivate
41
Deactivates all clients. They keep running but will not subscribe to any
42
channels and buffer data until activated again.
43
44
45
rec [Seconds]
46
Starts a recording. If SECS_TO_RECORD is given, the recording will be stopped
47
afterwards.
48
49
50
savebuffer
51
Saves the content of the current pre-buffer to its own measurement.
52
53
54
stop
55
Stops the current recording.
56
57
58
status [--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 can
62
be omitted, if the given measurement id / hostname is unique.
63
64
65
comment [MeasID] <Comment>
66
Adds a comment to a measurement. If no ID is given, the comment will be added
67
to the last measurement.
68
69
70
upload [MeasID]
71
Uploads a measurement. If no ID is given, all measurements that can be
72
uploaded will be uploaded.
73
74
75
delete <MeasID>
76
Deletes the given measurement from all machines.
77
78
79
sleep <Seconds>
80
Sleeps for the given amount of time. Usefull when automatically piping input
81
to eCAL Rec via stdin.
82
83
84
exit
85
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 --interactive
    rem 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