Difference between revisions of "Odbedit"

From MidasWiki
Jump to navigation Jump to search
Line 2: Line 2:
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
 
* [[odbedit command list]]
 
* [[odbedit command list]]
* [[odbedit command examples]]
+
* [[Odbedit examples]]
 
* [[mhttpd]] webserver
 
* [[mhttpd]] webserver
 
* [[Online Database]]
 
* [[Online Database]]
Line 10: Line 10:
  
 
== Introduction ==  
 
== Introduction ==  
The MIDAS  <span style="color:darkcyan;">''odbedit''</span>  utility  is primarily an [[Online Database (ODB)]] Editor. It also acts as a run control and has limited run monitoring features, so is an alternative to the web-based run control program [[mhttpd]]. On the other hand, <span style="color:darkcyan;">''mhttpd''</span> has limited editing capability, and does not support all of the features of <span style="color:darkcyan;">''odbedit''</span>.  
+
The MIDAS  <span style="color:darkcyan;">''odbedit''</span>  utility  is primarily an [[Online Database (ODB)]] Editor. It also acts as a run control and has limited run monitoring features, so is an alternative to the web-based run control program [[mhttpd]]. On the other hand, <span style="color:darkcyan;">''mhttpd''</span> is more user-friendly, but has limited editing capability and does not support all of the features of <span style="color:darkcyan;">''odbedit''</span>.  
  
 
The features of  <span style="color:darkcyan;">''odbedit''</span>  include
 
The features of  <span style="color:darkcyan;">''odbedit''</span>  include
 +
 
* create the ODB of the desired size
 
* create the ODB of the desired size
 +
* edit/list/create/rename/re-order/delete ODB keys
 +
* create (soft)links to ODB keys
 
* save all or part of the ODB onto disk and reload from a saved file
 
* save all or part of the ODB onto disk and reload from a saved file
* list/create/rename/re-order/delete ODB keys
 
* edit contents of ODB keys
 
* create (soft)links to ODB keys
 
 
* start/stop runs
 
* start/stop runs
 
* list and shutdown active clients
 
* list and shutdown active clients
 
* create a c-structure from the ODB  
 
* create a c-structure from the ODB  
 
* change a key's access mode (e.g. read-only)
 
* change a key's access mode (e.g. read-only)
* execute a list of commands from a file
+
* execute a list of odbedit commands from a file
 
* connect to corrupted ODB
 
* connect to corrupted ODB
  
Line 67: Line 67:
 
==== Creating the ODB ====
 
==== Creating the ODB ====
  
When <span style="color:darkcyan;">''odbedit''</span>  is started for the first time, if there is no existing ODB for the (see [[Common Parameters to MIDAS Utilities #Midas experiment (exptname)|experiment]]),
+
When <span style="color:darkcyan;">''odbedit''</span>  is started for the first time for a Midas [[Common Parameters to MIDAS Utilities #Midas experiment (exptname)|experiment]], if there is no existing ODB for that experiment,
 
the ODB will be created with the default size of 128KB, unless overruled by the  
 
the ODB will be created with the default size of 128KB, unless overruled by the  
 
[[odbedit #Starting odbedit utility |odbedit ''-s <size>'']] argument, e.g.
 
[[odbedit #Starting odbedit utility |odbedit ''-s <size>'']] argument, e.g.
Line 92: Line 92:
 
  start
 
  start
 
   
 
   
This external command feature allows for sophisticated shell scripts to be created that can manipulate the odb.
+
This external command feature allows for sophisticated '''shell scripts''' to be created that can '''manipulate the odb'''.
 
Such scripts can for example
 
Such scripts can for example
  

Revision as of 14:59, 23 June 2015

Links

Introduction

The MIDAS odbedit utility is primarily an Online Database (ODB) Editor. It also acts as a run control and has limited run monitoring features, so is an alternative to the web-based run control program mhttpd. On the other hand, mhttpd is more user-friendly, but has limited editing capability and does not support all of the features of odbedit.

The features of odbedit include

  • create the ODB of the desired size
  • edit/list/create/rename/re-order/delete ODB keys
  • create (soft)links to ODB keys
  • save all or part of the ODB onto disk and reload from a saved file
  • start/stop runs
  • list and shutdown active clients
  • create a c-structure from the ODB
  • change a key's access mode (e.g. read-only)
  • execute a list of odbedit commands from a file
  • connect to corrupted ODB


odbedit treats the hierarchical online database very much like a file system. Most commands are similar to UNIX file commands, e.g. ls, cd, chmod, ln etc. The help command displays a short description of all commands.

The odbedit commands and mode of operation are described fully in the following sections.

Starting odbedit utility

Arguments
   [-h hostname ]     : see common parameters 
   [-e exptname ]     : see  common parameters 
   [-c command ]      : Perform a single command. See using an external command
   [-c @commandFile ] : Perform commands in sequence found in the commandFile. See using an external command file
   [-s size ]         : Size in bytes (for ODB creation). See creating the ODB.
   [-d ODB Subtree]   : Specify the initial entry ODB path to go to. See Specifying the ODB entry path.
   [-g ]              : Debug
   [-C ]              : Connect to corrupted ODB
   [-R ]              : Reload ODB from .ODB.SHM
Usage
   >odbedit

Command Line Interpreter

ODBedit has a simple command line interface with command line editing similar to the UNIX tcsh shell. The following edit keys are implemented:

[Backspace]          Erase the character left from cursor
[Delete/Ctrl-D]      Erase the character under cursor
[Ctrl-W/Ctrl-U]      Erase the current line
[Ctrl-K]             Erase the line from cursor to end
[Left arrow/Ctrl-B]  Move cursor left
[Right arrow/Ctrl-F] Move cursor right
[Home/Ctrl-A]        Move cursor to beginning of line
[End/Ctrl-E]         Move cursor to end of line
[Up arrow/Ctrl-P]    Recall previous command
[Down arrow/Ctrl-N]  Recall next command
[Ctrl-F]             Find most recent command which starts with current line
[Tab/Ctrl-I]         Complete the path. The command ls /Sy <tab> becomes ls /System.


Creating the ODB

When odbedit is started for the first time for a Midas experiment, if there is no existing ODB for that experiment, the ODB will be created with the default size of 128KB, unless overruled by the odbedit -s <size> argument, e.g.

odbedit -s 2049000

Using an external command

In the simplest case, a single odbedit command can be entered on the command line using the -c argument, e.g.

[pol@isdaq01 src]$ odbedit -c start
Starting run #401
Run #401 started
[pol@isdaq01 src]$ odbedit -c stop
Run #401 stopped

Using an external command file

Perform commands in sequence found in the specified commandFile e.g.

[pol@isdaq01 pol]$ odbedit -d /Equipment/TDC/Settings/ -c @testfile.com 

where the file "testfile.com" contains odbedit commands, such as

set testval 4 
ls testval
start

This external command feature allows for sophisticated shell scripts to be created that can manipulate the odb. Such scripts can for example

  • check ODB parameters prior to beginning of run
  • send run parameters to the electronic logbook

Scripts using the external command feature are often used at begin and end of run, see also /Programs/execute on start run


Specifying the initial ODB entry path

The odbedit -d argument is used in conjunction with the -c argument to specify the initial path, e.g.

[pol@isdaq01 pol]$ odbedit -d /test -c "set testval 3"
[pol@isdaq01 pol]$ odb
[local:pol:S]/>ls test
testval


Changing the prompt

The format of the odbedit prompt can be changed. See format of the odbedit prompt.

odbedit command list

Click above link for list of odbedit commands and examples.