If you are preparing a system that will be used many times, you may want to automate the startup as well as run the Readout software under the control of a Readout Gui called ReadoutShell. Normally this automation is done by:
Writing scripts to start each of the components of the system.
Attaching these scripts to icons on a KDE desktop.
The trickiest issue for creating scripts that will become desktop icons is that the environment in which you are running your scripts and programs is not well known. You should ensure that each script sources appropriate login scripts and sets the working directory you want your application to run in. We will generate four scripts:
A script to run SpecTcl
A script to initialize SpecTcl, loading in our histogram definitions and connecting it to the appropriate online system.
A script to run the ReadoutShell Readout GUI.
A script that will be used by the ReadoutShell to start the readout program.
The following script will be used to start SpecTcl:
Example 4-1. SpecTcl startup script.
#!/bin/bash . /etc/profile #. ~/.bashrc cd ~/experiment/spectcl #
./SpecTcl <setup.tcl #
![]()
Refer to the numbers in the listing above when reading the annotations below:
In our startup script for SpecTcl we pointed the SpecTcl stdin at the file setup.tcl. This file will setup the initial spectrum definitions and attach SpecTcl to the online system.
The spectcl.tcl startup script is as shown below:
Example 4-2. The spectcl.tcl SpecTcl startup script
source myspectra.tcl; #sbind -all; #
.gui.b update; #
if {[array names env DAQHOST] ne ""} { set daqsource $env(DAQHOST) } else {; #
set daqsource "localhost" } set url "tcp://$daqsource:2602"; #
attach -pipe /usr/opt/daq/current/bin/spectcldaq $url; #
start; #
![]()
The numbers in the explanation below refer to the numbers in the example above.
DAQHOST
to store the name of the host on which
Readout runs. This code sets daqsource
to be the value of the DAQHOST
environment variable if it is
defined, or to localhost if it is not. This establishes
the system from which data will be analyzed.url
to be the url corresponding to the spectrodaq server
buffer request socket for the host daqsource
.