-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sh
executable file
·179 lines (145 loc) · 3.56 KB
/
start.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
export LC_ALL=C
unset MAKEFLAGS
module load intel/11.1.080
OAR_FILE="meso_OMP.oar"
#OAR_FILE="job.oar"
#------------------------------------------------------
# COLOR, baby!
#------------------------------------------------------
# Reset
Color_Off='\e[0m' # Text Reset
# Regular Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
Blue='\e[0;34m' # Blue
Purple='\e[0;35m' # Purple
Cyan='\e[0;36m' # Cyan
White='\e[0;37m' # White
# Bold
BBlack='\e[1;30m' # Black
BRed='\e[1;31m' # Red
BGreen='\e[1;32m' # Green
BYellow='\e[1;33m' # Yellow
BBlue='\e[1;34m' # Blue
BPurple='\e[1;35m' # Purple
BCyan='\e[1;36m' # Cyan
BWhite='\e[1;37m' # White
#------------------------------------------------------
# check call ok
#------------------------------------------------------
if [ "$1" == "" ]
then
echo -e ${BCyan}"make or not?"${Color_Off}
exit 1
fi
if [ "$2" == "" ]
then
echo -e ${BCyan}"directory?"${Color_Off}
exit 1
fi
#------------------------------------------------------
# check if directory exists.
#------------------------------------------------------
if [ $2 != '' ]
then
if [ ! -d "$2" ]
then
echo -e ${BRed}"did not find directory"${Color_Off}
exit 1
fi
fi
#------------------------------------------------------
# make if you like
#------------------------------------------------------
if [ $1 == "make" ]
then
make meso
fi
# success?
if [ ! -f "dns.out" ]
then
echo -e ${BRed}"MAKE FAILED"${Color_Off}
exit 1
fi
akt=$PWD #get parent directory
#------------------------------------------------------
# clean directory
#------------------------------------------------------
if [ "$3" == "yes" ] # clean directory if desired
then
cd "$2"
rm -Rf vor/
rm -Rf vor2/
rm -Rf press/
rm -Rf press2/
rm -Rf fields/
rm -Rf mask/
rm -Rf mvt/
rm -Rf fix/
mkdir tmp
mv *.oar tmp/
mv PARAMS.m tmp/
mv epsilons tmp/
mv *.in tmp/
mv *.inicond tmp/
mv *.sh tmp/
rm *
mv tmp/* ./
rm -R tmp/
cd $akt #go back to parent directory
fi
echo -e ${BCyan}"------------------------------------"${Color_Off}
echo -e ${BGreen}$2${Color_Off}
# copy exceutable file
cp dns.out "$2"
archiv="$(date +'%Y.%m.%d_%H.%M.%S').code.tar.gz"
echo ${archiv}
tar czf "${archiv}" *.f90 makefile PARAMS.m
mv ${archiv} $2
cd "$2"
#--now we're in the target directory
echo -e ${BCyan}"------------------------------------"${Color_Off}
if [ "$4" == "sure" ]
then
#--------------------------------------
# Start directly without asking
#--------------------------------------
echo -e ${Yellow}
cat ${OAR_FILE}
echo -e ${Cyan}
cat PARAMS.m
echo -e ${Color_Off}
oarsub -S ./${OAR_FILE}
echo -e ${BGreen}"*** RUNNING ***"${Color_Off}
else
#--------------------------------------
# Start, but interactively
#--------------------------------------
start='k'
while [ $start != "n" ]
do
echo -e ${Yellow}
cat ${OAR_FILE}
echo -e ${Cyan}
cat PARAMS.m
echo -e ${Color_Off}
echo -n -e ${BGreen}"Start ? (y for start, P to edit PARAMS.m, D to edit dns.pbs, n to abort "${Color_Off}
read start
if [ $start == "y" ]
then
start='n'
oarsub -S ./${OAR_FILE}
echo -e ${BGreen}"*** RUNNING ***"${Color_Off}
fi
if [ $start == "P" ]
then
nano PARAMS.m
fi
if [ $start == "D" ]
then
nano ${OAR_FILE}
fi
done
fi