-
Notifications
You must be signed in to change notification settings - Fork 2
/
gudgo
executable file
·67 lines (54 loc) · 2.28 KB
/
gudgo
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
#!/bin/bash
# Simple script to handle execution of Gudrun, offering ability to specify target input file to load on startup
GUDRUNBASE=/home/tris/src/Gudrun2016/Gudrun
# Check for input file
if [ $# -eq 0 ]; then
echo "No input file supplied - starting Gudrun with default startup file..."
cd $GUDRUNBASE
# Reconstruct vanilla sysparN
rm GudrunGUI.sysparN
echo "bin/gudrun_dcs;" > GudrunGUI.sysparN
echo "bin/purge_det;" >> GudrunGUI.sysparN
echo "rungnuplot.sh;" >> GudrunGUI.sysparN
echo "rungnuplotplot.sh;" >> GudrunGUI.sysparN
echo "/home/tris/src/Gudrun2016/Gudrun/StartupFiles/NIMROD/NIMRODstartup.txt;" >> GudrunGUI.sysparN
echo ";" >> GudrunGUI.sysparN
# Run gudrun
java -Xmx1g -Duser.language=en -cp "./GudrunGUI" -jar "./GudrunGUI/GudrunGUI_4.jar" N
else
# An argument was supplied, which we will assume is a valid input file...
# However, we need to know if its a relative or absolute path to the input file...
if [[ "$1" = /* ]]; then
# Absolute path - keep as is
INPUTFILE=$1
else
# Relative path - convert to absolute path
INPUTFILE=`pwd`/$1
fi
# Now, check if input file exists...
if [ ! -e $INPUTFILE ]; then
echo "Specified input file '$INPUTFILE' does not exist."
exit 1
fi
echo "Starting up with specified input file '$INPUTFILE'..."
# We need to modify the default GudrunN_linux.syspar to load our input file
# The target input file is on line 5 of the file - keep everything else the same...
cd $GUDRUNBASE
# Construct custom sysparN
rm GudrunGUI.sysparN
echo "bin/gudrun_dcs;" > GudrunGUI.sysparN
echo "bin/purge_det;" >> GudrunGUI.sysparN
echo "rungnuplot.sh;" >> GudrunGUI.sysparN
echo "rungnuplotplot.sh;" >> GudrunGUI.sysparN
echo "$INPUTFILE;" >> GudrunGUI.sysparN
echo ";" >> GudrunGUI.sysparN
java -Xmx1g -Duser.language=en -cp "./GudrunGUI" -jar "./GudrunGUI/GudrunGUI_4.jar" N
# Once finished, we must reconstruct GudrunN_linux.syspar (since some other settings may have been changed)
#head -n 4 GudrunGUI.sysparN > temp.syspar
#gawk 'NR == 5 { print $0 }' GudrunN_linux.syspar >> temp.syspar
#tail -n 1 GudrunGUI.sysparN >> temp.syspar
# Backup the old GudrunN_linux.syspar, just in case
#cp GudrunN_linux.syspar GudrunN_linux.syspar.bak
#mv temp.syspar GudrunN_linux.syspar
fi
exit 0