Tag Archive: command line

While JNIORs can be configured via their Webpages or from the support tool, using the command line can offer more powerful ways to interact with them. Commands from the command line can capture network data, provide accurate logging of I/O activations, offer in-depth control on applications and more. Interacting with the help search at the bottom right of the JNIOR web page can open up the JNIOR User Manual. 

This manual allows you to search for helpful information on configuring the JNIOR. We’ve generated a print out of this manual, and its accessible here. Specifically, the User Commands section should help explain what commands you can use in the command line to interact with the JNIOR.

Even though any information you’d need about the command line can be found in the JNIOR User Manual, below are links to posts about command line commands that may quicken/simplify your search for what command you may need.

Name Version Release Date Size MD5
RegEdit v1.0 Feb 17 2023 8.8 KB 2c558e281994ff235b1d15ec6d618db0

What is the RegEdit Utility?

JANOS v2.0 removed the classic command line registry editor.  The regedit utility brings back that command line functionality within an add-on application. regedit starts by displaying the root registry directory, which is where the registry starts for the JNIOR. Unlike how editing the registry currently works with Series 4 units, the regedit utility displays the full registry with a number value for each folder/key in the command line. regedit allows you to either display a folders contents, edit/delete a registry key, or add a new folder/key. 

Adding a key

When inside a folder or in the root directory key, you can add a new key. Simply enter the name of the key you wish to create. You’ll then be prompted to add new values to this key. Because the JNIOR registry can’t contain empty keys in it, if you don’t enter a value for the key you are creating the key will instantly after being created. After entering value for the key, it will display what the key with its value. After hitting ‘y’ to accept the key. it will be created and redisplay your current folder’s registry keys.

Adding a folder

Adding a new folder can be done when you add a new key. When adding a new key, you add the folder name beforehand to set the folder the key resides in. For example, if you wanted to create a folder with the name ‘testing’ that contains a key named ‘key’, you would type ‘testing/key’ and then enter a value for that key. A key must be created with a new folder, since folders can’t be empty in the JNIOR registry. Just like a key, if an empty folder is added it is instantly deleted.

Viewing a folders content

When a number entered is associated with a registry folder, regedit will ‘enter’ that folder by displaying the folders/keys inside of it and giving each one a number. You can then repeat the process of entering another registry folder or then edit a registry key, the only difference being that you can go back to the previous folder you were in by typing the number associated with the ‘<previous>’ value.

Editing/Deleting a key

When a number is entered that is associated with a registry key, regedit will display the key and its value and prompt you to either change, edit, or remove the key. To do one of these of options, you’ll just enter the first character for any of these options (‘c’ to change, ‘e’ to edit, ‘r’ to remove). The change option allows you to re-enter a brand new value for the key you are editing. The edit option is similar to the change option, but leaves the previous value the key had for you to edit. Lastly, the remove option simply removes the key from the registry. You’ll be prompted one additional time to confirm removing the key before the remove goes through.

Deleting a whole folder

While inside a registry folder, typing the * key will allow you to delete the entire folder you are in. Be careful using this to make sure you don’t delete necessary folders on the JNIOR.

When an operating system like JANOS is created it first reaches out to the world through the simplest communications channel, a serial port. When the developer then wants to interact with the new OS, commands are entered through that Command Line Interface. Soon a reasonable vocabulary of commands are made available for use and this becomes the developer’s Console.

As the operating system finds new ways to communicate with its surroundings it discovers the network and begins to support useful protocols. Logically the first would be some serial channel simulation (Telnet) over which it can offer access to its Command Line Interface for use by others. Eventually, graphical user interfaces emerge and a more modern and user-friendly environment comes into existence.

While the Command Line may seem Old School and it may generate some apprehension on the part of a new user, it is the Go-To utility for the developer. It is here that the system’s vitals can be monitored and the OS can be encouraged to perform for us. It is no surprise that the Command Line has been a key element of the JNIOR from the beginning. We will cover aspects of this user interface that have been enhanced with JANOS v2.0.

Persistent Command History

Every JNIOR, even back to the Series 3, memorized a few commands as you entered them during the Console session. It has always been possible to scroll back to a prior command using the cursor UPARROW and DNARROW keys. This allowed you to scroll to a command and re-execute it by hitting ENTER. You could even edit the command to create a new similar command and execute that. The Series 4 more than doubled the number of individual commands that it would remember during the session.

With JANOS v2.0 this command line history is now persistent. Meaning that you can exit the Console session, return at a later time and scroll back to commands that were entered in prior sessions. This persistent history is saved by User and so each user has his/her own. The same user can even access the Console simultaneously through different channels and retrieve past command history, not have confusion over commands entered in the other session, and see the logical combination of activities later. The number of commands remembered has been expanded to 99. This history, however, remains available ONLY as long as the JNIOR stays powered.

HISTORY Command

The HISTORY command has always been available and it displays those memorized commands. With Series 3 it was just a few and with Series 4 a longer list. But in those instances it otherwise had little utility.

With JANOS v2.0 the HISTORY command has been expanded to provide better access to the (now larger) record of commands. 

bruce_dev /> help history
HISTORY [index|regex]

Options:
index Integer selects command for editing
regex Used for case-insensitive search

Accesses the command line history.
Aliases: HIST, HISTORY

bruce_dev />

For example, if you had entered a command earlier to reboot the JNIOR with some options that you now want to repeat, you can locate that command by typing hist boot. The HIST command being just a shortened alias for HISTORY. The “boot” text is used as a Regular Expression to search the history and any line matching the inquiry is listed. If there is only one matching line it will be selected and brought to the command line to be edited or executed. This command is now very useful.

When multiple lines are listed they are enumerated. You can select any command by entering its index. For example, hist 5 will retrieve the command line displayed with index 5 for editing and execution.

TAB Key

The <TAB> key has become useful in later versions of JANOS. It provides a means of auto-completion. For example, when entering a parameter to a command you can type the first couple of characters of a file or folder name and use the <TAB> key.  JANOS will finish the entry with matching file of folder names. Repeated use of the <TAB> key scrolls through all possible matches and returns to your original line if none meets your need. If the name you seek is displayed you can merely continue to enter your command having been saved from explicitly typing the entire file or folder specification. Warning: You will become addicted to this aid. As much as you want it to, the Series 3 will not do it.

The <TAB> key in fact is context sensitive. If you are entering a REGISTRY command (REG for short) the auto-completion will use known or existing Registry keys instead of file or folder names. In addition, if you have entered the REG command, a Registry key and then the equals ‘=’ sign, if you immediately hit <TAB> (before any space) the current key’s value will be supplied. This is very useful, first if you cannot precisely remember a Registry key and then if you only want to modify the existing value slightly.

The context for auto-completion may be ambiguous in some places. JANOS may offer Registry keys when you in fact desire a Filename. As an alternative to the <TAB> key in those situations, if you need a file name you may use the Ctrl-F keystroke. Similarly, if you need a Registry key, you can use Ctrl-R.

At the beginning of a line you can enter the first character or two of a command and use <TAB>. This will auto-complete with valid commands and even offer matching commands from your command history.  But, of course, some people do like to type.

Finally, imagine that you have just loaded an unruly named UPD file into the /temp folder and need to execute a manual update using the JRUPDATE command. The following generally builds the command for you without much thought:

jru<TAB> -fup t<TAB>/<TAB>

The above sequence could save you from typing something like this:

jrupdate -fup temp/janos-2.4.2.upd

This is best experienced through experimentation. Give it a try.

That command, by the way, would update the operating system and only the operating system on the JNIOR.  The -U option schedules the update provided by the UPD file; The -F option (which can be specified as show or as a separate option and anywhere in the command) answers Yes to the confirmation prompt; And, the -P option Proceeds after ingesting the UPD file to perform the reboot and associated update.

More thorough updates are completed using the Support Tool and the appropriate Update Projects.

 

Once a JNIOR is up and running in an application it rarely needs attention. In fact many users forget that it is even there. It is however good practice to check the system logs once and a while. Fortunately there are a number of ways that you can do that. If you open the DCP (Dynamic Configuration Pages) by accessing the unit with a browser there is a ‘Syslog’ tab. This displays the log with the most recent events right at the top. You can also go to the ‘Console’ tab or otherwise open the Command Line through a Telnet connection or the serial port where you can list the log content directly to the screen or window. In this case the latest entries are the last listed.

If you are developing a new application and testing it on the JNIOR you may wish to monitor the log more closely. Naturally you can leave the DCP open on the ‘Syslog’ tab and new events would just pop up when they are logged. That might not be as convenient as it sounds especially if you are building a network-facing application and are constantly testing and working with the JNIOR using various browsers. Perhaps you are rebooting the unit causing the DCP to reconnect far too often. More typically we periodically make a Command Line connection through Telnet and manually list the log. Here we make use of the CAT command.

mqtt-test /> help cat
CAT filespec

Options:
 -H             Dump file in hex
 -J             Formats JSON
 -P             Displays last page

Displays the contents of a file.
Aliases: CAT, TYPE

mqtt-test /> cat -p jniorsys.log

Now the jniorsys.log file is limited to about 64KB characters. That can represent a lot of lines. Do you really want to list those every time? Here we see that the CAT command also provides the -P option which will show only the last page (25 lines) of the file. Of course you do have to remember to include the option. One side note here is that with JANOS you can supply the options anywhere on the line. So if you at first forget to include the -P you can place it after the filename. No problem.

We can improve on this by making use of JANOS batch file capabilities. A batch file is a kind of script file that can contain commands to be executed one after another. Most operating systems, JANOS included, provide some facility for batch execution. But you might be wondering how do you create batch files or if you do that externally how do you get them onto the JNIOR? Well here’s a tip: You can create them on the fly. Of course, the simpler the file the easier that can be accomplished.

For example we will create a simple batch file called log.bat as as kind of short hand that we can use when we want to display the System Log. Here we simply ECHO the command routing the text to the file. Immediately we can use the short batch file name to execute the command.

mqtt-test /> echo cat -p jniorsys.log > log.bat

mqtt-test /> log
cat -p jniorsys.log
10/03/18 18:54:15.850, FTP/10.0.0.27:58531 uploaded /flash/MQTT.jar [325.8 kbps]
10/03/18 18:54:24.571, ... (etc.)

Here we see that we used the ‘>’ pipe character to route the output to the specified file. If you need to build a batch file with more than one command you can append to it using ‘>>’ as well. The power here comes in combining commands to achieve some goal. The advantage being that you can repeat the procedure easily using the batch file name as shorthand. While batch files in JANOS are not as fully featured as you will find in Linux or MS-DOS systems most of the basics are there.

Suppose instead we want to list only today’s events. Here we create our batch file in way that lists only those entries with today’s date. Check it out.

mqtt-test /> echo grep %DATE% jniorsys.log > log.bat

mqtt-test /> log
grep 10/04/18 jniorsys.log
10/04/18 12:10:48.657, Ending session Command/10.0.0.27:64514 (pid 132)
10/04/18 12:37:53.642, Command/10.0.0.27:64075 login 'jnior' (pid 405)
10/04/18 12:38:05.179, FTP/10.0.0.27:64118 login 'jnior'
10/04/18 12:38:05.711 ... (etc.)

And there you go. You now have a simple way to check recent System Log activity. Now I bet that you are thinking how you might alter this to be even more helpful. Well, if you find that you cannot achieve what you have in mind just let us know. An advantage that you have with INTEG is a direct link to the technical team and the advantage we have is the power to implement what you need.