source: flex_extract.git/setup.sh @ 3a54479

ctbtodev
Last change on this file since 3a54479 was 3a54479, checked in by Anne Philipp <anne.philipp@…>, 4 years ago

added automatic python3 loading on ECMWF servers in setup and run scripts

  • Property mode set to 100755
File size: 2.9 KB
RevLine 
[2fb99de]1#!/bin/bash
2#
3# @Author: Anne Philipp
4#
5# @Date: September, 10 2018
6#
7# @Description:
[433d1eb]8#    This file defines the flex_extract's available installation
9#    parameters and puts them together for the call of the actual
[afbd3a1]10#    python installation script. It also does some checks to
11#    guarantee necessary parameters were set.
12#
13# @Licence:
[5f67883]14#    (C) Copyright 2014-2020.
[afbd3a1]15#
16#    SPDX-License-Identifier: CC-BY-4.0
17#
18#    This work is licensed under the Creative Commons Attribution 4.0
19#    International License. To view a copy of this license, visit
20#    http://creativecommons.org/licenses/by/4.0/ or send a letter to
21#    Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
[2fb99de]22#
23# -----------------------------------------------------------------
24# AVAILABLE COMMANDLINE ARGUMENTS TO SET
25#
[433d1eb]26# THE USER HAS TO SPECIFY THESE PARAMETERS
[2fb99de]27#
28TARGET='ecgate'
[d2b7217]29MAKEFILE='makefile_ecgate'
[f7b9666]30ECUID='<username>'
31ECGID='<groupID>'
32GATEWAY='<gatewayname>'
[50f9ca6]33DESTINATION='<username>@genericSftp'
[433d1eb]34INSTALLDIR=None
35JOB_TEMPLATE=''
36CONTROLFILE='CONTROL_EA5'
[2fb99de]37# -----------------------------------------------------------------
38#
39# AFTER THIS LINE THE USER DOES NOT HAVE TO CHANGE ANYTHING !!!
40#
41# -----------------------------------------------------------------
42
43# PATH TO INSTALLATION SCRIPT
[ba99230]44script="Source/Python/install.py"
[2fb99de]45
46# INITIALIZE EMPTY PARAMETERLIST
47parameterlist=""
48
[3a54479]49# CHECK IF ON ECMWF SERVER;
50if [[ $HOST == *"ecgb"* ]] || [[ $HOST == *"cca"* ]] || [[ $HOST == *"ccb"* ]]; then
51# LOAD PYTHON3 MODULE
52  module load python3
53fi 
54
[2fb99de]55# DEFAULT PARAMETERLIST
56if [ -n "$TARGET" ]; then
57  parameterlist=" --target=$TARGET"
58else
59  echo "ERROR: No installation target specified."
60  echo "EXIT WITH ERROR"
61  exit
62fi
63
64# CHECK FOR MORE PARAMETER
[3a54479]65if [ "$TARGET" == "ecgate" ] || [ "$TARGET" == "cca" ] || [ "$TARGET" == "ccb" ]; then
[2fb99de]66  # check if necessary Parameters are set
[50f9ca6]67  if [ -z "$ECUID" ] || [ -z "$ECGID" ] || [ "$ECUID" == "<username>" ] || [ "$ECGID" == "<groupID>" ] ; then
68    echo "ERROR: At least one of the following parameters are not properly set: ECUID or ECGID!"
[2fb99de]69    echo "EXIT WITH ERROR"
70    exit
71  else
72    parameterlist+=" --ecuid=$ECUID --ecgid=$ECGID --gateway=$GATEWAY --destination=$DESTINATION"
73  fi
[50f9ca6]74  if [ -z "$GATEWAY" ] || [ -z "$DESTINATION" ] || [ "$GATEWAY" == "<gatewayname>" ] || [ "$DESTINATION" == "<username>@genericSftp" ] ; then
75    echo "WARNING: Not setting parameters GATEWAY and DESTINATION means there will be no file transfer to local gateway server."
76  fi
[2fb99de]77fi
78if [ -n "$MAKEFILE" ]; then
79  parameterlist+=" --makefile=$MAKEFILE"
80fi
[83b8e3c]81if [ -n "$FLEXPARTDIR" ]; then # not empty
82  parameterlist+=" --flexpartdir=$FLEXPARTDIR"
[2fb99de]83fi
84if [ -n "$JOB_TEMPLATE" ]; then
85  parameterlist+=" --job_template=$JOB_TEMPLATE"
86fi
87if [ -n "$CONTROLFILE" ]; then
88  parameterlist+=" --controlfile=$CONTROLFILE"
89fi
90
91# -----------------------------------------------------------------
92# CALL INSTALLATION SCRIPT WITH DETERMINED COMMANDLINE ARGUMENTS
93
94$script $parameterlist
95
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG