File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88BIN=$HOME
99SHACL=$HOME /shacl
1010DATA=/mnt/datagovbe
11+ MIN_SIZE=24500100
12+ # Git
13+ USER=$GIT_USER
14+ TOKEN=$GIT_TOKEN
15+ NAME=$GIT_NAME
16+ EMAIL=$GIT_EMAIL
17+ LOCAL=dcat.git
1118
1219# Create directories (if not yet present)
1320makedirs () {
@@ -114,7 +121,32 @@ compress() {
114121# Parameter: project code
115122publish () {
116123 step $1 " publish"
117- status $1 " publish" $2 $?
124+
125+ F_SIZE=$( stat --format=%s $DATA /$1 /datagovbe_edp.xml.gz)
126+ if [[ $F_SIZE > $MIN_SIZE ]]; then
127+ rm -rf $LOCAL
128+
129+ git clone --depth=1 https://$TOKEN @github.com/Fedict/dcat.git
130+ git config user.name " $NAME "
131+ git config user.email " $EMAIL "
132+
133+ cp $DATA /$1 /datagovbe.nt.gz $LOCAL /all/datagovbe.nt.gz
134+ cp $DATA /$1 /datagovbe_edp.xml.gz $LOCAL /all/datagovbe_edp.xml.gz
135+
136+ cd $LOCAL
137+ git commit -sam " Updated export"
138+ git push
139+
140+ res=$?
141+
142+ cd -
143+ rm -rf $LOCAL
144+ else
145+ echo " ERROR $F_SIZE is too small" > /mnt/logs/$1 /publish.log
146+ res=-1
147+ fi
148+
149+ status $1 " publish" $2 $res
118150}
119151
120152# Main
@@ -123,7 +155,7 @@ publish() {
123155
124156source=$1
125157
126- if [ ! -d $DATA /$source ]; then
158+ if [[ ! -d $DATA /$source ] ]; then
127159 makedirs $source
128160fi
129161
@@ -132,7 +164,7 @@ scrape $source
132164validate $source
133165convert $source
134166
135- if [ $? -eq 0 ]; then
167+ if [[ $? -eq 0 ] ]; then
136168 compress $source
137169 publish $source
138170fi
You can’t perform that action at this time.
0 commit comments