1 | #!/bin/ksh |
---|
2 | # $Id$ |
---|
3 | #----------------------------------------------- |
---|
4 | #- Installation de scripts de post_traitement |
---|
5 | #----------------------------------------------- |
---|
6 | b_n=$(basename $0) |
---|
7 | d_n=$(dirname $0) |
---|
8 | |
---|
9 | #- Saisie et validation des options |
---|
10 | x_v='silencious'; |
---|
11 | x_d='normal'; |
---|
12 | x_t=""; |
---|
13 | x_n=""; |
---|
14 | |
---|
15 | while getopts :hvd:t: ops |
---|
16 | do |
---|
17 | case $ops in |
---|
18 | (h) echo "Usage : "${b_n} \ |
---|
19 | " [-h] [-v] [-d] [-t h] [-n f]"; |
---|
20 | echo " -h : help"; |
---|
21 | echo " -v : verbose mode"; |
---|
22 | echo " -d : debug mode"; |
---|
23 | echo " -t h : target host_name"; |
---|
24 | echo "Defaults : -t local_host"; |
---|
25 | exit 0;; |
---|
26 | (v) x_v='verbose';; |
---|
27 | (d) x_d='debug';; |
---|
28 | (t) x_t=${OPTARG};; |
---|
29 | (:) echo ${b_n}" : -"${OPTARG}" option : missing value" 1>&2; |
---|
30 | exit 2;; |
---|
31 | (\?) echo ${b_n}" : -"${OPTARG}" option : not supported" 1>&2; |
---|
32 | exit 2;; |
---|
33 | esac |
---|
34 | done |
---|
35 | shift $(($OPTIND-1)); |
---|
36 | |
---|
37 | if [ "$x_t" = "sx8brodie" ]; then |
---|
38 | b_n_post=$(basename $HOME) |
---|
39 | d_n_post=$(dirname $HOME | sed 's/home/u/') |
---|
40 | elif [ "$x_t" = "fjvpp" ]; then |
---|
41 | b_n_post=$(basename $DMFDIR) |
---|
42 | d_n_post=\/$(dirname $DMFDIR | awk -F\/ '{print $4}') |
---|
43 | elif [ "$x_t" = "sx6nec" ]; then |
---|
44 | b_n_post=$(basename $DMFDIR) |
---|
45 | d_n_post=$(dirname $DMFDIR) |
---|
46 | elif [ "$x_t" = "sx8mercure" ]; then |
---|
47 | b_n_post=$(basename $DMFDIR) |
---|
48 | d_n_post=$(dirname $DMFDIR) |
---|
49 | else |
---|
50 | echo " !!! WARNING !!!" |
---|
51 | echo " The path for the output files on the storage server," |
---|
52 | echo " needed for post-traitement files, is not automaticaly set." |
---|
53 | echo " Please specify manually this path by replacing the AAAAAAA" |
---|
54 | echo " string in the Output Job with the desired path." |
---|
55 | echo " !!! WARNING !!!" |
---|
56 | fi |
---|
57 | #- Traitement des options |
---|
58 | #- REAL precision |
---|
59 | # Target_Host Name |
---|
60 | if [ '\?'${x_t} = '\?' ]; then |
---|
61 | x_t=`${d_n}/w_i_h`; |
---|
62 | if [ $? -ne 0 ]; then |
---|
63 | echo "Bad installation : w_i_h/uname unreachable" 1>&2; |
---|
64 | exit 1; |
---|
65 | elif [ "$x_t" = "Unknown" ]; then |
---|
66 | echo "Local_Host not supported" 1>&2; |
---|
67 | exit 1; |
---|
68 | fi; |
---|
69 | fi; |
---|
70 | |
---|
71 | case ${x_t} in |
---|
72 | ( aix | cray | fjvpp | linux | lxiv7 | lxiv8 | osf1 | \ |
---|
73 | solaris | t3e | sx8brodie | sx6nec | sx8mercure | unix ) ;; |
---|
74 | (*) |
---|
75 | echo "Target_Host "${x_t}" not supported" 1>&2; |
---|
76 | exit 1;; |
---|
77 | esac |
---|
78 | #- |
---|
79 | x_m=$( (cd $d_n ; pwd) | sed -e "s,/util,," ) |
---|
80 | |
---|
81 | if [ ${x_v} = 'verbose' ]; then |
---|
82 | echo '--- Mode : '${x_v}; |
---|
83 | echo '--- Compilation : '${x_d}; |
---|
84 | echo '--- Target : '${x_t}; |
---|
85 | echo '--- Name : '${x_n}; |
---|
86 | echo '--- MODIPSL directory : '${x_m}; |
---|
87 | fi; |
---|
88 | #- |
---|
89 | #- |
---|
90 | l_rep1=`find ${d_n}/.. -name mo2st -print` |
---|
91 | l_rep2=`find ${d_n}/.. -name da2st -print` |
---|
92 | l_rep3=`find ${d_n}/.. -name mo2se -print` |
---|
93 | l_rep4=`find ${d_n}/.. -name da2mo -print` |
---|
94 | l_rep5=`find ${d_n}/.. -name da4mo -print` |
---|
95 | l_rep6=`find ${d_n}/.. -name da2ye -print` |
---|
96 | l_rep7=`find ${d_n}/.. -name da4ye -print` |
---|
97 | l_rep8=`find ${d_n}/.. -name mo2ye -print` |
---|
98 | l_rep9=`find ${d_n}/.. -name mo4ye -print` |
---|
99 | l_rep10=`find ${d_n}/.. -name mo2sn -print` |
---|
100 | l_rep11=`find ${d_n}/.. -name da2sn -print` |
---|
101 | l_rep12=`find ${d_n}/.. -name txt2tar -print` |
---|
102 | l_rep13=`find ${d_n}/.. -name monitoring_script -print` |
---|
103 | l_rep14=`find ${d_n}/.. -name monitoring_loop_script -print` |
---|
104 | l_rep15=`find ${d_n}/.. -name monitoring_loop2_script -print` |
---|
105 | l_rep16=`find ${d_n}/.. -name atlas_cpl_se_ORCA_LIM -print` |
---|
106 | l_rep17=`find ${d_n}/.. -name atlas_cpl_se -print` |
---|
107 | l_rep18=`find ${d_n}/.. -name atlas_cpl_se_LMDZOR -print` |
---|
108 | l_rep19=`find ${d_n}/.. -name atlas_cpl_se_ORCA_LIM2 -print` |
---|
109 | l_rep20=`find ${d_n}/.. -name create_ts -print` |
---|
110 | #- |
---|
111 | #- |
---|
112 | |
---|
113 | |
---|
114 | W_OS=${x_t}; |
---|
115 | |
---|
116 | if [ ${W_OS} = "sx8brodie" ]; then |
---|
117 | format='\s' |
---|
118 | elif [ ${W_OS} = "fjvpp" ]; then |
---|
119 | format='\d' |
---|
120 | elif [ ${W_OS} = "sx6nec" ]; then |
---|
121 | format='\g' |
---|
122 | elif [ ${W_OS} = "sx8mercure" ]; then |
---|
123 | format='\g' |
---|
124 | else |
---|
125 | echo " !!! WARNING !!!" |
---|
126 | echo " The display format of numbers," |
---|
127 | echo " needed for the dates, is not automaticaly set." |
---|
128 | echo " Please specify manually this format by replacing the PPPPPPP" |
---|
129 | echo " string in the Output Job with the desired format." |
---|
130 | echo " !!! WARNING !!!" |
---|
131 | fi |
---|
132 | |
---|
133 | echo " "; |
---|
134 | echo "Installation of simple execution jobs for $W_OS"; |
---|
135 | echo " "; |
---|
136 | #- |
---|
137 | |
---|
138 | for i in $l_rep1 $l_rep2 $l_rep3 $l_rep4 $l_rep5 $l_rep6 $l_rep7 $l_rep8 $l_rep9 $l_rep10 $l_rep11 $l_rep12 $l_rep13 $l_rep14 $l_rep15 $l_rep16 $l_rep17 $l_rep18 $l_rep19 $l_rep20 |
---|
139 | do |
---|
140 | echo " " |
---|
141 | case $i in |
---|
142 | "$l_rep1") j=$(dirname $i); |
---|
143 | MKTR="$j"; |
---|
144 | r=$(cd $j ; pwd); |
---|
145 | echo "Installation of mo2st.job file in directory : $(cd $j ; pwd) "; |
---|
146 | typeset -R W_XX[1]; |
---|
147 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
148 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/mo2st | grep -v '^#-Q- ' $1 > ${r}/mo2st.job ;; |
---|
149 | "$l_rep2") j=$(dirname $i); |
---|
150 | MKTR="$j"; |
---|
151 | r=$(cd $j ; pwd); |
---|
152 | echo "Installation of da2st.job file in directory : $(cd $j ; pwd) "; |
---|
153 | typeset -R W_XX[1]; |
---|
154 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
155 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/da2st | grep -v '^#-Q- ' $1 > ${r}/da2st.job ;; |
---|
156 | "$l_rep3") j=$(dirname $i); |
---|
157 | MKTR="$j"; |
---|
158 | r=$(cd $j ; pwd); |
---|
159 | echo "Installation of mo2se.job file in directory : $(cd $j ; pwd) "; |
---|
160 | typeset -R W_XX[1]; |
---|
161 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
162 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/mo2se | grep -v '^#-Q- ' $1 > ${r}/mo2se.job ;; |
---|
163 | "$l_rep4") j=$(dirname $i); |
---|
164 | MKTR="$j"; |
---|
165 | r=$(cd $j ; pwd); |
---|
166 | echo "Installation of da2mo.job file in directory : $(cd $j ; pwd) "; |
---|
167 | typeset -R W_XX[1]; |
---|
168 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
169 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/da2mo | grep -v '^#-Q- ' $1 > ${r}/da2mo.job ;; |
---|
170 | "$l_rep5") j=$(dirname $i); |
---|
171 | MKTR="$j"; |
---|
172 | r=$(cd $j ; pwd); |
---|
173 | echo "Installation of da4mo.job file in directory : $(cd $j ; pwd) "; |
---|
174 | typeset -R W_XX[1]; |
---|
175 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
176 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/da4mo | grep -v '^#-Q- ' $1 > ${r}/da4mo.job ;; |
---|
177 | "$l_rep6") j=$(dirname $i); |
---|
178 | MKTR="$j"; |
---|
179 | r=$(cd $j ; pwd); |
---|
180 | echo "Installation of da2ye.job file in directory : $(cd $j ; pwd) "; |
---|
181 | typeset -R W_XX[1]; |
---|
182 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
183 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/da2ye | grep -v '^#-Q- ' $1 > ${r}/da2ye.job ;; |
---|
184 | "$l_rep7") j=$(dirname $i); |
---|
185 | MKTR="$j"; |
---|
186 | r=$(cd $j ; pwd); |
---|
187 | echo "Installation of da4ye.job file in directory : $(cd $j ; pwd) "; |
---|
188 | typeset -R W_XX[1]; |
---|
189 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
190 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/da4ye | grep -v '^#-Q- ' $1 > ${r}/da4ye.job ;; |
---|
191 | "$l_rep8") j=$(dirname $i); |
---|
192 | MKTR="$j"; |
---|
193 | r=$(cd $j ; pwd); |
---|
194 | echo "Installation of mo2ye.job file in directory : $(cd $j ; pwd) "; |
---|
195 | typeset -R W_XX[1]; |
---|
196 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
197 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/mo2ye | grep -v '^#-Q- ' $1 > ${r}/mo2ye.job ;; |
---|
198 | "$l_rep9") j=$(dirname $i); |
---|
199 | MKTR="$j"; |
---|
200 | r=$(cd $j ; pwd); |
---|
201 | echo "Installation of mo4ye.job file in directory : $(cd $j ; pwd) "; |
---|
202 | typeset -R W_XX[1]; |
---|
203 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
204 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/mo4ye | grep -v '^#-Q- ' $1 > ${r}/mo4ye.job ;; |
---|
205 | "$l_rep10") j=$(dirname $i); |
---|
206 | MKTR="$j"; |
---|
207 | r=$(cd $j ; pwd); |
---|
208 | echo "Installation of mo2sn.job file in directory : $(cd $j ; pwd) "; |
---|
209 | typeset -R W_XX[1]; |
---|
210 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
211 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/mo2sn | grep -v '^#-Q- ' $1 > ${r}/mo2sn.job ;; |
---|
212 | "$l_rep11") j=$(dirname $i); |
---|
213 | MKTR="$j"; |
---|
214 | r=$(cd $j ; pwd); |
---|
215 | echo "Installation of da2sn.job file in directory : $(cd $j ; pwd) "; |
---|
216 | typeset -R W_XX[1]; |
---|
217 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
218 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/da2sn | grep -v '^#-Q- ' $1 > ${r}/da2sn.job ;; |
---|
219 | "$l_rep12") j=$(dirname $i); |
---|
220 | MKTR="$j"; |
---|
221 | r=$(cd $j ; pwd); |
---|
222 | echo "Installation of txt2tar.job file in directory : $(cd $j ; pwd) "; |
---|
223 | typeset -R W_XX[1]; |
---|
224 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
225 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/txt2tar | grep -v '^#-Q- ' $1 > ${r}/txt2tar.job ;; |
---|
226 | "$l_rep13") j=$(dirname $i); |
---|
227 | MKTR="$j"; |
---|
228 | r=$(cd $j ; pwd); |
---|
229 | echo "Installation of monitoring_script.job file in directory : $(cd $j ; pwd) "; |
---|
230 | typeset -R W_XX[1]; |
---|
231 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
232 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/monitoring_script | grep -v '^#-Q- ' $1 > ${r}/monitoring_script.job ;; |
---|
233 | "$l_rep14") j=$(dirname $i); |
---|
234 | MKTR="$j"; |
---|
235 | r=$(cd $j ; pwd); |
---|
236 | echo "Installation of monitoring_loop_script.job file in directory : $(cd $j ; pwd) "; |
---|
237 | typeset -R W_XX[1]; |
---|
238 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
239 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/monitoring_loop_script | grep -v '^#-Q- ' $1 > ${r}/monitoring_loop_script.job ;; |
---|
240 | "$l_rep15") j=$(dirname $i); |
---|
241 | MKTR="$j"; |
---|
242 | r=$(cd $j ; pwd); |
---|
243 | echo "Installation of monitoring_loop2_script.job file in directory : $(cd $j ; pwd) "; |
---|
244 | typeset -R W_XX[1]; |
---|
245 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS ; |
---|
246 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/monitoring_loop2_script | grep -v '^#-Q- ' $1 > ${r}/monitoring_loop2_script.job ;; |
---|
247 | "$l_rep16") j=$(dirname $i); |
---|
248 | MKTR="$j"; |
---|
249 | r=$(cd $j ; pwd); |
---|
250 | echo "Installation of atlas_cpl_se_ORCA_LIM.job file in directory : $(cd $j ; pwd) "; |
---|
251 | typeset -R W_XX[1]; |
---|
252 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
253 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/atlas_cpl_se_ORCA_LIM | grep -v '^#-Q- ' $1 > ${r}/atlas_cpl_se_ORCA_LIM.job ;; |
---|
254 | "$l_rep17") j=$(dirname $i); |
---|
255 | MKTR="$j"; |
---|
256 | r=$(cd $j ; pwd); |
---|
257 | echo "Installation of atlas_cpl_se.job file in directory : $(cd $j ; pwd) "; |
---|
258 | typeset -R W_XX[1]; |
---|
259 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
260 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/atlas_cpl_se | grep -v '^#-Q- ' $1 > ${r}/atlas_cpl_se.job ;; |
---|
261 | "$l_rep18") j=$(dirname $i); |
---|
262 | MKTR="$j"; |
---|
263 | r=$(cd $j ; pwd); |
---|
264 | echo "Installation of atlas_cpl_se_LMDZOR.job file in directory : $(cd $j ; pwd) "; |
---|
265 | typeset -R W_XX[1]; |
---|
266 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
267 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/atlas_cpl_se_LMDZOR | grep -v '^#-Q- ' $1 > ${r}/atlas_cpl_se_LMDZOR.job ;; |
---|
268 | "$l_rep19") j=$(dirname $i); |
---|
269 | MKTR="$j"; |
---|
270 | r=$(cd $j ; pwd); |
---|
271 | echo "Installation of atlas_cpl_se_ORCA_LIM2.job file in directory : $(cd $j ; pwd) "; |
---|
272 | typeset -R W_XX[1]; |
---|
273 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
274 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/atlas_cpl_se_ORCA_LIM2 | grep -v '^#-Q- ' $1 > ${r}/atlas_cpl_se_ORCA_LIM2.job ;; |
---|
275 | "$l_rep20") j=$(dirname $i); |
---|
276 | MKTR="$j"; |
---|
277 | r=$(cd $j ; pwd); |
---|
278 | echo "Installation of create_ts.job file in directory : $(cd $j ; pwd) "; |
---|
279 | typeset -R W_XX[1]; |
---|
280 | set -A W_XX '\#\-D\-' '#-Q- '$W_OS; |
---|
281 | sed -e "/^.*${W_XX[0]}$/d" -e "s,^${W_XX[1]}*,," -e "s,AAAAAAA,${d_n_post}\/${b_n_post},g" -e "s,PPPPPPP,${format},g" ${MKTR}/create_ts | grep -v '^#-Q- ' $1 > ${r}/create_ts.job ;; |
---|
282 | esac |
---|
283 | done |
---|
284 | echo " "; |
---|
285 | exit 0; |
---|