7# ------------------------------------------------------------------------------------------
9# Example script to run JDAQDriver.
11# ------------------------------------------------------------------------------------------
15if [ -z $JPP_DIR ]; then
16 echo "Variable JPP_DIR undefined."
21source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
27set_variable SERVER localhost
28set_variable LOGGER localhost
31set_variable TIMEOUT_S 3
32set_variable RUNTIME_S 1
33set_variable HOST `get_ip_address`
34set_variable HOST1 $HOST
35set_variable HOST2 $HOST
36set_variable HOST3 $HOST
37set_variable HOST4 $HOST
39set_variable EVENT_NUMBER 1234
42# re-start ligier for command and logger messages
49# example to read event associated data from a file
51cat>${TMPDIR:-/tmp}/ev_init.txt<<EOF
58cat>${TMPDIR:-/tmp}/driver.txt<<EOF
60# To avoid unnecessary shell processes, the process I/O is redirected to /dev/null and the ssh command is quoted.
61# Note that process with extension /- will deliberately crash during the configure transition
62# and process with extension /+ will sleep forever during the exit transition.
64process JDAQDemoClient/A $HOST1 (setenv ROOTSYS $ROOTSYS && source $JPP_DIR/setenv.csh $JPP_DIR && JDAQDemoClient -u %/A -H \$SERVER\$ -M \$LOGGER\$ -d $DEBUG </dev/null >&/dev/null) &;
65process JDAQDemoClient/B $HOST2 (setenv ROOTSYS $ROOTSYS && source $JPP_DIR/setenv.csh $JPP_DIR && JDAQClientStarter -H $HOST3:$PORT -m "-H \$SERVER\$ -M \$LOGGER\$ -d $DEBUG");
66process JDAQDemoClient/- $HOST3 (setenv ROOTSYS $ROOTSYS && source $JPP_DIR/setenv.csh $JPP_DIR && JDAQDemoClient -u \$NAME\$ -H \$SERVER\$ -M \$LOGGER\$ -d $DEBUG </dev/null >&/dev/null) &;
67process JDAQDemoClient/+ $HOST4 (setenv ROOTSYS $ROOTSYS && source $JPP_DIR/setenv.csh $JPP_DIR && JDAQDemoClient -u \$NAME\$ -H \$SERVER\$ -M \$LOGGER\$ -d $DEBUG </dev/null >&/dev/null) &;
71event ev_init:$EVENT_NUMBER { RC_CMD %<${TMPDIR:-/tmp}/ev_init.txt>%from me%<${TMPDIR:-/tmp}/ev_init.txt>% }
72event ev_configure { RC_CMD 2 1 }
74# Client with extension /- should have crashed by now.
75# So, put failed clients to sleep with names containing given character sequence.
77filter JDAQDemoClient/-;
79event ev_start { RC_CMD $RUN 1 }
83event ev_pause { RC_CMD }
84event ev_stop { RC_CMD }
85event ev_reset { RC_CMD }
86event ev_off { RC_CMD }
91# The following process is assumed to run 'forever', i.e.
92# it is started before the driver and continues thereafter.
93# It is therefore killed by hand at the end of the show.
95JDAQDemoClient -u JDAQDemoClient/B -P $PORT &
99JDAQDriver -H $SERVER -M $LOGGER -d $DEBUG -t $TIMEOUT_S -f ${TMPDIR:-/tmp}/driver.txt -c