forked from bmoffit/coda_scripts
-
Notifications
You must be signed in to change notification settings - Fork 1
/
startEMU.sh
executable file
·97 lines (77 loc) · 1.76 KB
/
startEMU.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
#
# Shell script to start coda_emu_*
#
# If no arguments, use coda_conf_functions to get EMU information
#
# Otherwise:
#
# startEMU.sh EMUNAME EMUOPTIONS
#
# Where EMUNAME is the name of the EMU component to start
# and EMUOPTIONS (optional) are any other arguments to copy to the coda_emu_*
# commandline
#
ARGS=$@
DEFAULT="-i -v"
PROG=$(basename $0)
TYPE=
CODA_EMU=
case "$PROG" in
"startER.sh" )
TYPE=ER
CODA_EMU=coda_emu_er
;;
"startSEB.sh" )
TYPE=SEB
CODA_EMU=coda_emu_seb
;;
"startDC.sh" )
TYPE=DC
CODA_EMU=coda_emu_dc
;;
"startPEB.sh" )
TYPE=PEB
CODA_EMU=coda_emu_peb
;;
* )
TYPE=PEB
CODA_EMU=coda_emu_peb
;;
esac
HOSTNAME=$(hostname -s)
# CODA 3 EMU needs JAVA_HOME define
if [ -z $JAVA_HOME ]; then
echo "ERROR: \$JAVA_HOME not defined!"
exit 1
fi
if [ ${#@} -gt 0 ]; then
# Get the EMU component name
EMUNAME=$1
# Get this EMU's commandline option
shift 1
EMUOPTION=$@
else
. coda_conf_functions
# Get the EMU component name
codaconf_get_component_name $HOSTNAME $TYPE
EMUNAME=$CODA_COMPONENT_NAME
# Get this ROC's commandline option
codaconf_get_name_option $HOSTNAME $EMUNAME
EMUOPTION=$CODA_COMPONENT_OPTION
fi
EMU_ACTIVE=$(pgrep -U $UID ${CODA_EMU})
if [ -n "$EMU_ACTIVE" ]; then
echo "WARNING: ${CODA_EMU} already running"
echo " killing them"
killall -v ${CODA_EMU}
fi
echo "************************************************************"
echo "Starting EMU on" $HOSTNAME
echo " Commandline =" $ARGS
echo " SESSION =" $SESSION
echo " EXPID =" $EXPID
echo " EMU name =" $EMUNAME
echo " EMU option =" $EMUOPTION
echo "************************************************************"
${CODA_EMU} $EMUNAME $EMUOPTION