No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

create_data_simpleem.sh 38KB

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