When I run the following command from Mikrotik SSH, I see an asterisk followed by a hex value, which will look something like like *4e
.
:put [:execute { :ping localhost count=10 }]
According to the Mikrotik wiki, the :execute
command executes commands in the background as a script job. When I print out the currently running jobs, I don't see any relation between the output above with the output of this.
[admin@MikroTik] > /system script job print
# SCRIPT OWNER STARTED
0 admin jun/05/2017 16:58:09
1 admin jun/05/2017 17:07:31
So, what does the output represent and how can I use it?
The return that you get is a MikroTik RouterOS Internal ID. In this case, this is an internal ID for the running job. Internal IDs are immutable references to the object which they represent and have the advantage of being the same between command executions even if concurrent operations are taking place which would change the objects #
as shown by print.
You can identify an internal ID by the *
followed by a hexadecimal number. In some cases, where there are multiple items to return as is common with find
, you will get a ;
delimited list of IDs such as:
*d;*1;*18;*3;*19;*1a;*20
Internal IDs can be used as when running other commands just like the printable number and is distinguished by the preceding *
. Where a list of multiple internal ids is given, the command will run on each item.
Information on the internal ID data type can be found in the Scripting Manual. Internal IDs do not follow any ordering and you should not assume that they do. To get the internal ID of an object from its ID show in a print output, you can use :put [get <id>]
where <id>
is the printable id - the output will show the internal id as the .id
property.