forked from EUDAT-B2FIND/md-ingestion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcron_ingest.sh
executable file
·61 lines (54 loc) · 1.19 KB
/
cron_ingest.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
#!/bin/bash
## Cronjob for B2FIND ingestion
syntax="Syntax: cron_test.sh community [fromdays targethost]"
# check arguments
if [[ $# -lt 1 ]];
then
printf "Missing argument:\n${syntax}\n"
exit -1
else
community=$1
if [ $community == '-h' ] || [ $community == '--help' ];
then
printf "${syntax}\n"
exit 0
fi
fi
if [[ -z $2 ]];
then
fromdateset=''
else
daysago=$2
if [ $daysago == 'all' ];
then
fromdateset=""
else
NDAYSAGO="${daysago} day ago"
fromdateval=`date --date="${NDAYSAGO}" +%Y-%m-%d`
fromdateset="--fromdate ${fromdateval}"
fi
fi
if [[ -z $3 ]];
then
targethost='eudatmd1.dkrz.de:8080'
else
targethost=$3
fi
# handle generation only for productive host (currently eudatmd1* )
handlecheck=''
if [[ $targethost == eudatmd1* ]];
then
handlecheck='--handle_check=credentials_11098'
fi
# set work directory
if [[ $(hostname) == centos* ]];
then
WORK="${HOME}/Projects/EUDAT/EUDAT-B2FIND/md-ingestion"
else
WORK="${HOME}/md-ingestion"
fi
TODAY=`date +\%F`
cd $WORK
set -x
./manager.py -c $community -i $targethost $handlecheck $fromdateset >log/ingest_${community}_${TODAY}.out 2>log/ingest_${community}_${TODAY}.err
exit 0