20th April 2007

CmdLinker

Tool to handle multiple command line programs

Description

CmdLinker is a quite simple program to execute multiple command-line programs, keeping them together in one only window.

It allows keeping those programs linked under a simple GUI, supporting operations like resetting the working programs, stopping all at once, etc.

CmdLinker is mainly useful to programmers and users who must spawn a set of non interactive command-line programs in order to achieve some predefined functionality.

For example, I use a proxy server, where I must setup two open virtual networks, and run a set of delegate scripts that allow me to forward network connections between the two virtual networks. Without CmdLinker, such setup requires opening 4 command line windows, where I execute the scripts that start the open virtual network conenctions, plus the scripts to run the delegate scripts that perform the network forwarding. Then , my desktop becomes cluttered with 4 windows or icons that are logically associated together!

CmdLinker allows me to keep those linked commands under one only window. It does not only improves my desktop, it improves my interaction with those programs, as I can stop all of them at once, or just restart them if needed.

The previous figure shows CmdLinker in action: each console/command application is run on its own tab window.

Version / Requirements

The current version of CmdLinker, is the 0.9.7. This version includes all the functionality that I considered required for a 1.0 version. This is a well tested version, run in Windows XP, Mac Os X 10.4 and Linux (Ubuntu 7.0.4). Would you run into problems, please send me a mail to my coderazzi address listed at the bottom of this page.

The current version is developed in Java. I use Eclipse with JDK 1.6, and you will need at least JDK 1.5 to run or execute it. If you plan to edit / modify the code, note that CmdLinker does not have further dependencies, it is just a simple Swing application.

I am not sure whether future versions will be developed in Java, or I will return to my initial approach using .Net with IronPython. Please not that all the consoles are used directly by the operative system, and CmdLinker only displays the produced output, in a really optimised way, so there is not real performance problem on using Java; my idea to use eventually Python is just based on possible improvements to the scripting support.

License and download

CmdLinker is delivered as it, without any responsabilities on the author. It is open source, it can be used or modified without any limitations.

The program is provided as .zip or .jar format. If you plan to just run the application, use the .jar format. The .zip format allows you to browse/edit the source code (it includes project files to access it from Eclipse).

Functionality

What can you do with CmdLinker? Mainly, just run sets of command line programs under a common, umbrella graphical interface:

  • Execute any command line program, that should not require any interaction.
  • Close/Terminate/Restart any running program.
  • Group programs: each group is shown on a separate CmdLinker window.
  • Typical GUI controls: apply specific background/foreground colors and fonts.
  • Good GUI interaction, using popup menus / menus when required.
  • Run specific CmdLinker scripts, detailed below.

Scripts

CmdLinker supports basic scripts to drive its operations; that is, it is possible to provide CmdLinker with a text script that instructs it to perform a set of basic operations:

  • Setup default colors and font.
  • Create a new console.
  • Apply specific colors and font to each console.
  • Execute a command line application.

The script is kept purposely simple. It is possible to execute any set of commands without knowing the specific script syntax. For example, the following script executes 3 different .sh scripts on 3 consoles:

/home/users/luismi/batch1.sh
/home/users/luismi/openvpn/asConnect.sh
/home/users/luismi/openvpn/viConnect.sh

Easy, not? This script could be customized as follows, to use specific font size, and different colors on each console:

font monospaced bold 12
createTab CheckConnection
colors white black
/home/users/luismi/batch1.sh
createTab Basic conenction
colors white blue
/home/users/luismi/openvpn/asConnect.sh
/home/users/luismi/openvpn/viConnect.sh
colors cyan blue

Usage

Each tab displays the command being executed, and, if finished, and status line is added at the top. It is possible to check quickly the status of each command by the icon on the tab. The icons are:

  •  :  The command is still on execution
  •  :  The command has finalized, with error code 0
  •  :  The command has finalized, with error code differente from zero
  •  :  There was some error that prevented the execution of the command
  •  :  The user stopped the command execution

The program should be easily used through the intuitive graphical interface. It must be specifically noted that, to mofify the font size and colors used by the program on each tab, it is needed to use the Options.. Display menu element. Changing the font size on the main window only modifies the font size of the tab console being displayed.

Under options, it is possible to specify whether to save the options or not. When saved, the options are kept among multiple program executions, including some default values, like last command executed, etc. In this case, a file with name cmdlinker.conf is stored in the home user directory.

Command line arguments

It is possible to provide CmdLinker with command line arguments:

  • -bg modifies the default background color. It can be provided as a well known color, like white, etc, or as a RGB value, using the notation #RRGGBB.
  • -fg modifies the default foreground color
  • -font modifies the font size. It expects, therefore, an integer, as the family font is always monospaced
  • -c expects one or more additional arguments, that specify the command to execute, and, optionally, the expected arguments. If provided, this must be the last argument
  • -check expects one additional argument, that specify the script to check

It is allowed to specify a script to execute by providing it as the last command line argument, if -c and -check are not specified

Uninstall

Uninstalling CmdLinkeris as easy as removing the associated jar file, and, if options where saved, the file cmdlinker.conf stored in the home user directory; the easiest way to remove this file is by unsetting the checkbox Save options in the options menu.