7 # ------------------------------------------------------------------------------------------
9 # Utility script to locally run JLigier.
11 # ------------------------------------------------------------------------------------------
13 if [ -
z $JPP_DIR ];
then
14 echo "Variable JPP_DIR undefined."
18 source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/
null
27 usage "$script [port] <option>"\
28 "\nPossible options: start, stop, continue, restart."
39 fatal
"Invalid option $OPTION."
46 if [[ $(uname) ==
"Darwin" ]];
then
47 alias get_pid=
"pgrep -lf '${APPLICATION} -P ${PORT}' | cut -d ' ' -f 1"
49 alias get_pid=
'eval ps h -o \"%p %a\" -C ${APPLICATION} | eval sed -n \"s/ \*\\\\\(\[0-9\]\*\\\\\) ${APPLICATION} \.\*-P ${PORT}\\\\\( \\\\\|\$\\\\\)\.\*/\\\1/p\"'
57 if [[ -
n $PID ]];
then
58 notice
"Stop $APPLICATION using port $PORT with PID $PID."
68 if [[ -
n $PID ]];
then
69 notice
"$APPLICATION using port $PORT is running with PID $PID."
80 if [[ -
n $PID ]];
then
81 fatal
"$APPLICATION using port $PORT is already running with PID $PID."
84 notice
"$APPLICATION -P $PORT -T $TIMEOUT_US -d $DEBUG --! >& $WORKDIR/ligier.log"
85 nohup $APPLICATION -
P $PORT -
T $TIMEOUT_US -
d $DEBUG --! >&
$WORKDIR/ligier.log &
87 for ((
i = 0;
$i != 20; ++
i ));
do
93 if [[ -
n $PID ]];
then
94 notice
"$APPLICATION using port $PORT is now running with PID $PID."
99 error
"$APPLICATION is not running on $HOST."
then usage $script< detector >< run >< outputfile > fi case set_variable OPTION
then usage $script[port]< option > nPossible restart fi case set_variable OPTION set_variable PORT
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR if do_usage *then usage $script[(input file)+] fi set_variable DEBUG set_variable WORKDIR TMPDIR
do set_variable OUTPUT_DIRECTORY $WORKDIR T
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable DEBUG set_variable WORKDIR
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
then usage $script[energy[distance[z of PMT]]] fi case set_variable z
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
then elif[["$OPTION"=="count"]]
*fatal Wrong option $OPTION
then getFile sh $JPP_ARCHIVE $DETECTOR_ID $RUNS[1] $KEY $VERSION $WORKDIR
esac $JPP_BIN JLogger sh $LOGGER until pgrep JGetMessage</dev/null > dev null
#define DEBUG(A)
Message macros.