|
@@ -0,0 +1,474 @@
|
|
1
|
+#!/bin/bash
|
|
2
|
+
|
|
3
|
+usage() {
|
|
4
|
+ echo -e "Usage : $0 host_of_server instance_name host_of_db number_of_iterations >&2"
|
|
5
|
+ echo -e "Example : create_datas locahost instance_00001 localhost:28015 1000"
|
|
6
|
+ echo -e "Example : create_datas locahost instance_00001 localhost 1000"
|
|
7
|
+ exit 1
|
|
8
|
+}
|
|
9
|
+
|
|
10
|
+if [ $# -lt 3 ]
|
|
11
|
+then
|
|
12
|
+ echo "Not enough arguments" >&2
|
|
13
|
+ usage
|
|
14
|
+fi
|
|
15
|
+
|
|
16
|
+host=$1
|
|
17
|
+instance=$2
|
|
18
|
+N=$4
|
|
19
|
+HOSTDB=$3
|
|
20
|
+dbname=lodel2_$instance
|
|
21
|
+dbuser=admin
|
|
22
|
+dbpwd=pass
|
|
23
|
+curl_options='--silent -o /dev/null -s -w %{url_effective};%{http_code};%{time_connect};%{time_starttransfer};%{time_total}\n'
|
|
24
|
+
|
|
25
|
+M=$(($N*20))
|
|
26
|
+for i in `eval echo {1..$M}`;
|
|
27
|
+do
|
|
28
|
+ # Classe Person
|
|
29
|
+ LN=$(lenmax=20;wcount=1; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
30
|
+ FN=$(lenmax=20;wcount=1; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
31
|
+ LC=''
|
|
32
|
+ curl -o /dev/null -s -d "field_input_lastname=$LN&field_input_firstname=$FN&field_input_linked_containers=$LC&classname=Person" http://$host/$instance/admin/create?classname=Person
|
|
33
|
+
|
|
34
|
+ # Classe User
|
|
35
|
+ PWD='pwgen 10'
|
|
36
|
+ LOGIN="${FN,,}$(printf "%d" $RANDOM)"
|
|
37
|
+ curl -o /dev/null -s -d "field_input_lastname=$LN&field_input_firstname=$FN&field_input_password=$PWD&field_input_login=$LOGIN&classname=User" http://$host/$instance/admin/create?classname=User
|
|
38
|
+
|
|
39
|
+ # Classe Entry, champs à remplir : name, description, role, linked_texts
|
|
40
|
+ ENLT='' #$(printf "use $dbname\nDBQuery.shellBatchSize = 30000\n db.Article.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | shuf | head -n 3; )
|
|
41
|
+ ENROLE=$(shuf -e 'geography' 'subject' 'keywords' | head -n 1)
|
|
42
|
+ ENTNM=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
43
|
+ ENTDESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
44
|
+ curl $curl_options -d "field_input_linked_texts=$ENLT&field_input_name=$ENTNM&field_input_role=$ENROLE&field_input_description=$ENTDESC&classname=Entry" http://$host/$instance/admin/create?classname=Entry
|
|
45
|
+done
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+M=$N #$(shuf -e '2' '3' '4' | head -n 1)
|
|
49
|
+for col in `eval echo {1..$M}`;
|
|
50
|
+do
|
|
51
|
+ # Classe Collection, champs à remplir : title, subtitle, language, linked_director, description, publisher_note, issn
|
|
52
|
+ NBLD=$(shuf -e '1' '2' '3' '4' | head -n 1)
|
|
53
|
+ directors=$(printf "use $dbname\n DBQuery.shellBatchSize = 30000\n db.Person.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n $NBLD;)
|
|
54
|
+ tmp=''
|
|
55
|
+ for j in $directors
|
|
56
|
+ do
|
|
57
|
+ if [[ ! -z $tmp ]]
|
|
58
|
+ then
|
|
59
|
+ tmp=$(printf "$tmp, $j")
|
|
60
|
+ else
|
|
61
|
+ tmp=$j
|
|
62
|
+ fi
|
|
63
|
+ done
|
|
64
|
+ COLLD=$tmp
|
|
65
|
+ COLT=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
66
|
+ COLST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
67
|
+ LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
|
|
68
|
+ DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
69
|
+ PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
70
|
+ ISSN=$(</dev/urandom tr -dc 0-9 | head -c8;echo;)
|
|
71
|
+ curl $curl_options -d "field_input_title=$COLT&field_input_subtitle=$COLST&field_input_language=$LG&field_input_linked_directors=$COLLD&field_input_description=$DESC&field_input_publisher_note=$PBN&field_input_issn=$ISSN&classname=Collection" http://$host/$instance/admin/create?classname=Collection
|
|
72
|
+ collection=$(printf "use $dbname\n db.Collection.find({}, {lodel_id:1, _id:0}).sort({_id:-1}).limit(1)" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d";)
|
|
73
|
+ NBNUM=$(shuf -e '30' '35' '40' | head -n 1 ) # Nombre de numéros pour cette collection
|
|
74
|
+
|
|
75
|
+ for i in `eval echo {1..$NBNUM}`; # On remplit les numéros
|
|
76
|
+ do
|
|
77
|
+ NB=$(shuf -e '25' '30' '35' '40' '45' '50' '55' '60' '65' | head -n 1) # Nombre de textes pour le numéro
|
|
78
|
+ NBR=$(($NB/3)) # Nombre de reviews
|
|
79
|
+ NBA=$(($NBR*2)) # Nombre d'articles
|
|
80
|
+
|
|
81
|
+ # Classe Issue, champs à remplir : title, subtitle, language, linked_directors, description, publisher_note, isbn, print_isbn, number, cover, print_pub_date, e_pub_date, abstract, collection, linked_parts, linked_texts
|
|
82
|
+ NBLD=$(shuf -e '1' '2' '3' '4' | head -n 1)
|
|
83
|
+ directors=$(printf "use $dbname\n DBQuery.shellBatchSize = 30000\n db.Person.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n $NBLD;)
|
|
84
|
+ tmp=''
|
|
85
|
+ for j in $directors
|
|
86
|
+ do
|
|
87
|
+ if [[ ! -z $tmp ]]
|
|
88
|
+ then
|
|
89
|
+ tmp=$(printf "$tmp, $j")
|
|
90
|
+ else
|
|
91
|
+ tmp=$j
|
|
92
|
+ fi
|
|
93
|
+ done
|
|
94
|
+ ISSLD=$tmp
|
|
95
|
+ ISST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
96
|
+ ISSST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
97
|
+ LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
|
|
98
|
+ DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
99
|
+ PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
100
|
+ ISBN=$(</dev/urandom tr -dc 0-9 | head -c10;echo;)
|
|
101
|
+ PISBN=$(</dev/urandom tr -dc 0-9 | head -c10;echo;)
|
|
102
|
+ ISSNU=$(lenmax=30;wcount=10; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
103
|
+ ISSCOV=$(lenmax=100;wcount=15; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
104
|
+ M=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' | head -n 1)
|
|
105
|
+ JJ=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '20' '21' '22' '23' '24' '25' '26' '27' '28' | head -n 1)
|
|
106
|
+ AA=$(shuf -e '2012' '2005' '2010' '2015' '2016'| head -n 1)
|
|
107
|
+ PPDATE=$AA'-'$M'-'$JJ
|
|
108
|
+ M=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' | head -n 1)
|
|
109
|
+ JJ=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '20' '21' '22' '23' '24' '25' '26' '27' '28' | head -n 1)
|
|
110
|
+ AA=$(shuf -e '2012' '2005' '2010' '2015' '2016'| head -n 1)
|
|
111
|
+ EPDATE=$AA'-'$M'-'$JJ
|
|
112
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c3;echo;)
|
|
113
|
+ ISSAB=$(lenmax=$LNG;wcount=200; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
114
|
+ ISSLPA=''
|
|
115
|
+ ISSLTXT=''
|
|
116
|
+ curl $curl_options -d "field_input_title=$ISST&field_input_subtitle=$ISSST&field_input_language=$LG&field_input_linked_directors=$ISSLD&field_input_description=$DESC&field_input_publisher_note=$PBN&field_input_isbn=$ISBN&field_input_print_isbn=$PISBN&field_input_number=$ISSNU&field_input_cover=$ISSCOV&field_input_print_pub_date=$PPDATE&field_input_e_pub_date=$EPDATE&field_input_abstract=$ISSAB&field_input_collection=$collection&field_input_linked_parts=$ISSLPA&field_input_linked_texts=$ISSLTXT&classname=Issue" http://$host/$instance/admin/create?classname=Issue
|
|
117
|
+ issue=$(printf "use $dbname\n db.Issue.find({}, {lodel_id:1, _id:0}).sort({_id:-1}).limit(1)" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" )
|
|
118
|
+
|
|
119
|
+ # On entre les textes correspondants aux numéros indépendemment des parts
|
|
120
|
+ NBT=$(shuf -e '2' '3' '4' '5' '6' '8' | head -n 1)
|
|
121
|
+ for i in `eval echo {1..$NBT}`;
|
|
122
|
+ do
|
|
123
|
+ # Classe Article, champs à remplir : title, subtitle, language, text, pub_date, footnotes, linked_entries, linked_persons, linked_container, abstract, appendix, bibliography, author_note
|
|
124
|
+ ATCT=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
125
|
+ ATCST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
126
|
+ LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
|
|
127
|
+ LNG=32000; #$(</dev/urandom tr -dc 0-9 | head -c5;echo;)
|
|
128
|
+ ATCTXT=$(lenmax=$LNG;wcount=12000; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
129
|
+ M=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' | head -n 1)
|
|
130
|
+ JJ=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '20' '21' '22' '23' '24' '25' '26' '27' '28' | head -n 1)
|
|
131
|
+ AA=$(shuf -e '2012' '2005' '2010' '2015' '2016'| head -n 1)
|
|
132
|
+ ATCDATE=$AA'-'$M'-'$JJ
|
|
133
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
|
|
134
|
+ ATCFN=$(lenmax=$LNG;wcount=2000; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
135
|
+ nb=$(( ( $RANDOM % 10 ) + 1 ))
|
|
136
|
+ entries=$(printf "use $dbname\nDBQuery.shellBatchSize = 30000\n db.Entry.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n $nb;)
|
|
137
|
+ tmp=""
|
|
138
|
+ for i in $entries
|
|
139
|
+ do
|
|
140
|
+ if [[ ! -z $tmp ]]
|
|
141
|
+ then
|
|
142
|
+ tmp=$(printf "$tmp, $i")
|
|
143
|
+ else
|
|
144
|
+ tmp=$i
|
|
145
|
+ fi
|
|
146
|
+ done
|
|
147
|
+ ATCLE=$tmp
|
|
148
|
+ nb=$(( ( $RANDOM % 10 ) + 1 ))
|
|
149
|
+ persons=$(printf "use $dbname\nDBQuery.shellBatchSize = 30000\n db.Person.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n $nb;)
|
|
150
|
+ tmp=""
|
|
151
|
+ for i in $persons
|
|
152
|
+ do
|
|
153
|
+ if [[ ! -z $tmp ]]
|
|
154
|
+ then
|
|
155
|
+ tmp=$(printf "$tmp, $i")
|
|
156
|
+ else
|
|
157
|
+ tmp=$i
|
|
158
|
+ fi
|
|
159
|
+ done
|
|
160
|
+ ATCLP=$tmp
|
|
161
|
+ ATCLC=$issue
|
|
162
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c3;echo;)
|
|
163
|
+ ATCAB=$(lenmax=$LNG;wcount=200; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
164
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
|
|
165
|
+ ATCAP=$(lenmax=$LNG;wcount=2000; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
166
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
|
|
167
|
+ ATCBI=$(lenmax=$LNG;wcount=2000; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
168
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c3;echo;)
|
|
169
|
+ ATCAN=$(lenmax=$LNG;wcount=200; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
170
|
+ curl $curl_options -d "field_input_title=$ATCT&field_input_subtitle=$ATCST&field_input_language=$LG&field_input_text=$ATCTXT&field_input_pub_date=$ATCDATE&field_input_footnotes=$ATCFN&field_input_linked_entries=$ATCLE&field_input_linked_persons=$ATCLP&field_input_linked_container=$ATCLC&field_input_abstract=$ATCAB&field_input_appendix=$ATCAP&field_input_bibliography=$ATCBI&field_input_author_note=$ATCAN&classname=Article" http://$host/$instance/admin/create?classname=Article
|
|
171
|
+ done
|
|
172
|
+ NBR=$(shuf -e '0' '2' '1' | head -n 1)
|
|
173
|
+ for i in `eval echo {1..$NBR}`;
|
|
174
|
+ do
|
|
175
|
+ # Classe Review, champs à remplir : title, subtitle, language, text, pub_date, footnotes, linked_entries, linked_persons, linked_container,reference
|
|
176
|
+ RET=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
177
|
+ REST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
178
|
+ LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
|
|
179
|
+ LNG=32000 #$(</dev/urandom tr -dc 0-9 | head -c5;echo;)
|
|
180
|
+ RETXT=$(lenmax=$LNG;wcount=12000; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
181
|
+ M=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' | head -n 1)
|
|
182
|
+ JJ=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '20' '21' '22' '23' '24' '25' '26' '27' '28' | head -n 1)
|
|
183
|
+ AA=$(shuf -e '2012' '2005' '2010' '2015' '2016'| head -n 1)
|
|
184
|
+ REDATE=$AA'-'$M'-'$JJ
|
|
185
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
|
|
186
|
+ REFN=$(lenmax=$LNG;wcount=2000; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
187
|
+ nb=$(( ( RANDOM % 10 ) + 1 ))
|
|
188
|
+ entries=$(printf "use $dbname\nDBQuery.shellBatchSize = 30000\n db.Entry.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n $nb;)
|
|
189
|
+ tmp=""
|
|
190
|
+ for i in $entries
|
|
191
|
+ do
|
|
192
|
+ if [[ ! -z $tmp ]]
|
|
193
|
+ then
|
|
194
|
+ tmp=$(printf "$tmp, $i")
|
|
195
|
+ else
|
|
196
|
+ tmp=$i
|
|
197
|
+ fi
|
|
198
|
+ done
|
|
199
|
+ RELE=$tmp
|
|
200
|
+ nb=$(( ( RANDOM % 10 ) + 1 ))
|
|
201
|
+ persons=$(printf "use $dbname\nDBQuery.shellBatchSize = 30000\n db.Person.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n $nb; )
|
|
202
|
+ tmp=""
|
|
203
|
+ for i in $persons
|
|
204
|
+ do
|
|
205
|
+ if [[ ! -z $tmp ]]
|
|
206
|
+ then
|
|
207
|
+ tmp=$(printf "$tmp, $i")
|
|
208
|
+ else
|
|
209
|
+ tmp=$i
|
|
210
|
+ fi
|
|
211
|
+ done
|
|
212
|
+ RELP=$tmp
|
|
213
|
+ RELC=$issue
|
|
214
|
+ REREF=$(lenmax=300;wcount=90; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
215
|
+ curl $curl_options -d "field_input_title=$RET&field_input_subtitle=$REST&field_input_language=$LG&field_input_text=$RETXT&field_input_pub_date=$REDATE&field_input_footnotes=$REFN&field_input_linked_entries=$RELE&field_input_linked_persons=$RELP&field_input_linked_container=$RELC&field_input_reference=$REREF&classname=Review" http://$host/$instance/admin/create?classname=Review
|
|
216
|
+ done
|
|
217
|
+ NBP=$(shuf -e '2' '3' | head -n 1) # Nombre de parts en relation directe avec des issues
|
|
218
|
+ for i in `eval echo {1..$NBP}`;
|
|
219
|
+ do
|
|
220
|
+ # Classe Part, champs à remplir : title, subtitle, language, linked_directors, description, publisher_note, isbn, print_isbn, number, cover, print_pub_date, e_pub_date, abstract, publication
|
|
221
|
+ NBLD=$(shuf -e '1' '2' '3' '4' | head -n 1)
|
|
222
|
+ directors=$(printf "use $dbname\n DBQuery.shellBatchSize = 30000\n db.Person.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n $NBLD;)
|
|
223
|
+ tmp=''
|
|
224
|
+ for j in $directors
|
|
225
|
+ do
|
|
226
|
+ if [[ ! -z $tmp ]]
|
|
227
|
+ then
|
|
228
|
+ tmp=$(printf "$tmp, $j")
|
|
229
|
+ else
|
|
230
|
+ tmp=$j
|
|
231
|
+ fi
|
|
232
|
+ done
|
|
233
|
+ PALD=$tmp
|
|
234
|
+ PAT=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
235
|
+ PAST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
236
|
+ LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
|
|
237
|
+ DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
238
|
+ PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
239
|
+ issue=$(printf "use $dbname\nDBQuery.shellBatchSize = 1000\n db.Issue.find({collection:$collection}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n 1;)
|
|
240
|
+ PALTXT=''
|
|
241
|
+ PALP=''
|
|
242
|
+ curl $curl_options -d "field_input_title=$PAT&field_input_subtitle=$PAST&field_input_language=$LG&field_input_linked_directors=$PALD&field_input_description=$DESC&field_input_publisher_note=$PBN&field_input_publication=$issue&field_input_linked_parts=$PALP&field_input_linked_texts=$PALTXT&classname=Part" http://$host/$instance/admin/create?classname=Part
|
|
243
|
+ part=$(printf "use $dbname\n db.Part.find({}, {lodel_id:1, _id:0}).sort({_id:-1}).limit(1)" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" )
|
|
244
|
+
|
|
245
|
+ # On entre les textes correspondants aux parts
|
|
246
|
+ NBPANBT=$(shuf -e '2' '3' '4' | head -n 1)
|
|
247
|
+ for i in `eval echo {1..$NBPANBT}`;
|
|
248
|
+ do
|
|
249
|
+ # Classe Article, champs à remplir : title, subtitle, language, text, pub_date, footnotes, linked_entries, linked_persons, linked_container, abstract, appendix, bibliography, author_note
|
|
250
|
+ ATCT=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
251
|
+ ATCST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
252
|
+ LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
|
|
253
|
+ LNG=32000 #$(</dev/urandom tr -dc 0-9 | head -c5;echo;)
|
|
254
|
+ ATCTXT=$(lenmax=$LNG;wcount=12000; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
255
|
+ M=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' | head -n 1)
|
|
256
|
+ JJ=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '20' '21' '22' '23' '24' '25' '26' '27' '28' | head -n 1)
|
|
257
|
+ AA=$(shuf -e '2012' '2005' '2010' '2015' '2016'| head -n 1)
|
|
258
|
+ ATCDATE=$AA'-'$M'-'$JJ
|
|
259
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
|
|
260
|
+ ATCFN=$(lenmax=$LNG;wcount=2000; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
261
|
+ nb=$(( ( RANDOM % 10 ) + 1 ))
|
|
262
|
+ entries=$(printf "use $dbname\nDBQuery.shellBatchSize = 30000\n db.Entry.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n $nb;)
|
|
263
|
+ tmp=""
|
|
264
|
+ for i in $entries
|
|
265
|
+ do
|
|
266
|
+ if [[ ! -z $tmp ]]
|
|
267
|
+ then
|
|
268
|
+ tmp=$(printf "$tmp, $i")
|
|
269
|
+ else
|
|
270
|
+ tmp=$i
|
|
271
|
+ fi
|
|
272
|
+ done
|
|
273
|
+ ATCLE=$tmp
|
|
274
|
+ nb=$(( ( RANDOM % 10 ) + 1 ))
|
|
275
|
+ persons=$(printf "use $dbname\nDBQuery.shellBatchSize = 30000\n db.Person.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n $nb;)
|
|
276
|
+ tmp=""
|
|
277
|
+ for i in $persons
|
|
278
|
+ do
|
|
279
|
+ if [[ ! -z $tmp ]]
|
|
280
|
+ then
|
|
281
|
+ tmp=$(printf "$tmp, $i")
|
|
282
|
+ else
|
|
283
|
+ tmp=$i
|
|
284
|
+ fi
|
|
285
|
+ done
|
|
286
|
+ ATCLP=$tmp
|
|
287
|
+ ATCLC=$part
|
|
288
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c3;echo;)
|
|
289
|
+ ATCAB=$(lenmax=$LNG;wcount=200; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
290
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
|
|
291
|
+ ATCAP=$(lenmax=$LNG;wcount=2000; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
292
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
|
|
293
|
+ ATCBI=$(lenmax=$LNG;wcount=2000; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
294
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c3;echo;)
|
|
295
|
+ ATCAN=$(lenmax=$LNG;wcount=200; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
296
|
+ curl $curl_options -d "field_input_title=$ATCT&field_input_subtitle=$ATCST&field_input_language=$LG&field_input_text=$ATCTXT&field_input_pub_date=$ATCDATE&field_input_footnotes=$ATCFN&field_input_linked_entries=$ATCLE&field_input_linked_persons=$ATCLP&field_input_linked_container=$ATCLC&field_input_abstract=$ATCAB&field_input_appendix=$ATCAP&field_input_bibliography=$ATCBI&field_input_author_note=$ATCAN&classname=Article" http://$host/$instance/admin/create?classname=Article
|
|
297
|
+ done
|
|
298
|
+ NBPANBR=$(shuf -e '0' '1' '2' | head -n 1)
|
|
299
|
+ for i in `eval echo {1..$NBPANBR}`;
|
|
300
|
+ do
|
|
301
|
+ # Classe Review, champs à remplir : title, subtitle, language, text, pub_date, footnotes, linked_entries, linked_persons, linked_container,reference
|
|
302
|
+ RET=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
303
|
+ REST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
304
|
+ LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
|
|
305
|
+ LNG=32000 #$(</dev/urandom tr -dc 0-9 | head -c5;echo;)
|
|
306
|
+ RETXT=$(lenmax=$LNG;wcount=12000; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
307
|
+ M=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' | head -n 1)
|
|
308
|
+ JJ=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '20' '21' '22' '23' '24' '25' '26' '27' '28' | head -n 1)
|
|
309
|
+ AA=$(shuf -e '2012' '2005' '2010' '2015' '2016'| head -n 1)
|
|
310
|
+ REDATE=$AA'-'$M'-'$JJ
|
|
311
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
|
|
312
|
+ REFN=$(lenmax=$LNG;wcount=2000; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
313
|
+ nb=$(( ( RANDOM % 10 ) + 1 ))
|
|
314
|
+ entries=$(printf "use $dbname\nDBQuery.shellBatchSize = 30000\n db.Entry.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n $nb;)
|
|
315
|
+ tmp=""
|
|
316
|
+ for i in $entries
|
|
317
|
+ do
|
|
318
|
+ if [[ ! -z $tmp ]]
|
|
319
|
+ then
|
|
320
|
+ tmp=$(printf "$tmp, $i")
|
|
321
|
+ else
|
|
322
|
+ tmp=$i
|
|
323
|
+ fi
|
|
324
|
+ done
|
|
325
|
+ RELE=$tmp
|
|
326
|
+ nb=$(( ( RANDOM % 10 ) + 1 ))
|
|
327
|
+ persons=$(printf "use $dbname\nDBQuery.shellBatchSize = 30000\n db.Person.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n $nb; )
|
|
328
|
+ tmp=""
|
|
329
|
+ for i in $persons
|
|
330
|
+ do
|
|
331
|
+ if [[ ! -z $tmp ]]
|
|
332
|
+ then
|
|
333
|
+ tmp=$(printf "$tmp, $i")
|
|
334
|
+ else
|
|
335
|
+ tmp=$i
|
|
336
|
+ fi
|
|
337
|
+ done
|
|
338
|
+ RELP=$tmp
|
|
339
|
+ RELC=$part
|
|
340
|
+ REREF=$(lenmax=300;wcount=90; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
341
|
+ curl $curl_options -d "field_input_title=$RET&field_input_subtitle=$REST&field_input_language=$LG&field_input_text=$RETXT&field_input_pub_date=$REDATE&field_input_footnotes=$REFN&field_input_linked_entries=$RELE&field_input_linked_persons=$RELP&field_input_linked_container=$RELC&field_input_reference=$REREF&classname=Review" http://$host/$instance/admin/create?classname=Review
|
|
342
|
+ done
|
|
343
|
+ NBSP=$(shuf -e '0' '1' '2' '3' | head -n 1) # Nombre de parts en relation avec d'autres parts
|
|
344
|
+ for i in `eval echo {1..$NBSP}`;
|
|
345
|
+ do
|
|
346
|
+ # Classe Part, champs à remplir : title, subtitle, language, linked_director, description, publisher_note, isbn, print_isbn, number, cover, print_pub_date, e_pub_date, abstract, publication
|
|
347
|
+ NBLD=$(shuf -e '1' '2' '3' '4' | head -n 1)
|
|
348
|
+ directors=$(printf "use $dbname\n DBQuery.shellBatchSize = 30000\n db.Person.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n $NBLD;)
|
|
349
|
+ tmp=''
|
|
350
|
+ for j in $directors
|
|
351
|
+ do
|
|
352
|
+ if [[ ! -z $tmp ]]
|
|
353
|
+ then
|
|
354
|
+ tmp=$(printf "$tmp, $j")
|
|
355
|
+ else
|
|
356
|
+ tmp=$j
|
|
357
|
+ fi
|
|
358
|
+ done
|
|
359
|
+ PALD=$tmp
|
|
360
|
+ PAT=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
361
|
+ PAST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
362
|
+ LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
|
|
363
|
+ DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
364
|
+ PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
365
|
+ PALTXT=''
|
|
366
|
+ PALP=''
|
|
367
|
+ curl $curl_options -d "field_input_title=$PAT
|
|
368
|
+ &field_input_subtitle=$PAST
|
|
369
|
+ &field_input_language=$LG
|
|
370
|
+ &field_input_linked_directors=$PALD
|
|
371
|
+ &field_input_description=$DESC&field_input_publisher_note=$PBN&field_input_publication=$part
|
|
372
|
+ &field_input_linked_parts=$PALP&field_input_linked_texts=$PALTXT&classname=Part" http://$host/$instance/admin/create?classname=Part
|
|
373
|
+ part=$(printf "use $dbname\n db.Part.find({}, {lodel_id:1, _id:0}).sort({_id:-1}).limit(1)" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" )
|
|
374
|
+
|
|
375
|
+ # On entre les textes correspondants aux numéros indépendemment des parts
|
|
376
|
+ for i in `eval echo {1..$NBA}`;
|
|
377
|
+ do
|
|
378
|
+ # Classe Article, champs à remplir : title, subtitle, language, text, pub_date, footnotes, linked_entries, linked_persons, linked_container, abstract, appendix, bibliography, author_note
|
|
379
|
+ ATCT=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
380
|
+ ATCST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
381
|
+ LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
|
|
382
|
+ LNG=32000 #$(</dev/urandom tr -dc 0-9 | head -c5;echo;)
|
|
383
|
+ ATCTXT=$(lenmax=$LNG;wcount=12000; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
384
|
+ M=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' | head -n 1)
|
|
385
|
+ JJ=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '20' '21' '22' '23' '24' '25' '26' '27' '28' | head -n 1)
|
|
386
|
+ AA=$(shuf -e '2012' '2005' '2010' '2015' '2016'| head -n 1)
|
|
387
|
+ ATCDATE=$AA'-'$M'-'$JJ
|
|
388
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
|
|
389
|
+ ATCFN=$(lenmax=$LNG;wcount=2000; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
390
|
+ nb=$(( ( RANDOM % 10 ) + 1 ))
|
|
391
|
+ entries=$(printf "use $dbname\nDBQuery.shellBatchSize = 30000\n db.Entry.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n $nb;)
|
|
392
|
+ tmp=""
|
|
393
|
+ for i in $entries
|
|
394
|
+ do
|
|
395
|
+ if [[ ! -z $tmp ]]
|
|
396
|
+ then
|
|
397
|
+ tmp=$(printf "$tmp, $i")
|
|
398
|
+ else
|
|
399
|
+ tmp=$i
|
|
400
|
+ fi
|
|
401
|
+ done
|
|
402
|
+ ATCLE=$tmp
|
|
403
|
+ nb=$(( ( RANDOM % 10 ) + 1 ))
|
|
404
|
+ persons=$(printf "use $dbname\nDBQuery.shellBatchSize = 30000\n db.Person.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n $nb;)
|
|
405
|
+ tmp=""
|
|
406
|
+ for i in $persons
|
|
407
|
+ do
|
|
408
|
+ if [[ ! -z $tmp ]]
|
|
409
|
+ then
|
|
410
|
+ tmp=$(printf "$tmp, $i")
|
|
411
|
+ else
|
|
412
|
+ tmp=$i
|
|
413
|
+ fi
|
|
414
|
+ done
|
|
415
|
+ ATCLP=$tmp
|
|
416
|
+ ATCLC=$part
|
|
417
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c3;echo;)
|
|
418
|
+ ATCAB=$(lenmax=$LNG;wcount=200; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
419
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
|
|
420
|
+ ATCAP=$(lenmax=$LNG;wcount=2000; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
421
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
|
|
422
|
+ ATCBI=$(lenmax=$LNG;wcount=2000; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
423
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c3;echo;)
|
|
424
|
+ ATCAN=$(lenmax=$LNG;wcount=200; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
425
|
+ curl $curl_options -s -d "field_input_title=$ATCT&field_input_subtitle=$ATCST&field_input_language=$LG&field_input_text=$ATCTXT&field_input_pub_date=$ATCDATE&field_input_footnotes=$ATCFN&field_input_linked_entries=$ATCLE&field_input_linked_persons=$ATCLP&field_input_linked_container=$ATCLC&field_input_abstract=$ATCAB&field_input_appendix=$ATCAP&field_input_bibliography=$ATCBI&field_input_author_note=$ATCAN&classname=Article" http://$host/$instance/admin/create?classname=Article
|
|
426
|
+ done
|
|
427
|
+ for i in `eval echo {1..$NBR}`;
|
|
428
|
+ do
|
|
429
|
+ # Classe Review, champs à remplir : title, subtitle, language, text, pub_date, footnotes, linked_entries, linked_persons, linked_container,reference
|
|
430
|
+ RET=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
431
|
+ REST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
432
|
+ LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
|
|
433
|
+ LNG=32000 #$(</dev/urandom tr -dc 0-9 | head -c5;echo;)
|
|
434
|
+ RETXT=$(lenmax=$LNG;wcount=12000; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
435
|
+ M=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' | head -n 1)
|
|
436
|
+ JJ=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '20' '21' '22' '23' '24' '25' '26' '27' '28' | head -n 1)
|
|
437
|
+ AA=$(shuf -e '2012' '2005' '2010' '2015' '2016'| head -n 1)
|
|
438
|
+ REDATE=$AA'-'$M'-'$JJ
|
|
439
|
+ LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
|
|
440
|
+ REFN=$(lenmax=$LNG;wcount=2000; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
441
|
+ nb=$(( ( RANDOM % 10 ) + 1 ))
|
|
442
|
+ entries=$(printf "use $dbname\nDBQuery.shellBatchSize = 30000\n db.Entry.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n $nb;)
|
|
443
|
+ tmp=""
|
|
444
|
+ for i in $entries
|
|
445
|
+ do
|
|
446
|
+ if [[ ! -z $tmp ]]
|
|
447
|
+ then
|
|
448
|
+ tmp=$(printf "$tmp, $i")
|
|
449
|
+ else
|
|
450
|
+ tmp=$i
|
|
451
|
+ fi
|
|
452
|
+ done
|
|
453
|
+ RELE=$tmp
|
|
454
|
+ nb=$(( ( RANDOM % 10 ) + 1 ))
|
|
455
|
+ persons=$(printf "use $dbname\nDBQuery.shellBatchSize = 30000\n db.Person.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n $nb; )
|
|
456
|
+ tmp=""
|
|
457
|
+ for i in $persons
|
|
458
|
+ do
|
|
459
|
+ if [[ ! -z $tmp ]]
|
|
460
|
+ then
|
|
461
|
+ tmp=$(printf "$tmp, $i")
|
|
462
|
+ else
|
|
463
|
+ tmp=$i
|
|
464
|
+ fi
|
|
465
|
+ done
|
|
466
|
+ RELP=$tmp
|
|
467
|
+ RELC=$issue
|
|
468
|
+ REREF=$(lenmax=300;wcount=90; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
469
|
+ curl $curl_options -d "field_input_title=$RET&field_input_subtitle=$REST&field_input_language=$LG&field_input_text=$RETXT&field_input_pub_date=$REDATE&field_input_footnotes=$REFN&field_input_linked_entries=$RELE&field_input_linked_persons=$RELP&field_input_linked_container=$RELC&field_input_reference=$REREF&classname=Review" http://$host/$instance/admin/create?classname=Review
|
|
470
|
+ done
|
|
471
|
+ done
|
|
472
|
+ done
|
|
473
|
+ done
|
|
474
|
+done
|