123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474 |
- #!/bin/bash
-
- usage() {
- echo -e "Usage : $0 host_of_server instance_name host_of_db number_of_iterations >&2"
- echo -e "Example : create_datas locahost instance_00001 localhost:28015 1000"
- echo -e "Example : create_datas locahost instance_00001 localhost 1000"
- exit 1
- }
-
- if [ $# -lt 3 ]
- then
- echo "Not enough arguments" >&2
- usage
- fi
-
- host=$1
- instance=$2
- N=$4
- HOSTDB=$3
- dbname=lodel2_$instance
- dbuser=admin
- dbpwd=pass
- curl_options='--silent -o /dev/null -s -w %{url_effective};%{http_code};%{time_connect};%{time_starttransfer};%{time_total}\n'
-
- M=$(($N*20))
- for i in `eval echo {1..$M}`;
- do
- # Classe Person
- 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/")
- 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/")
- LC=''
- 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
-
- # Classe User
- PWD='pwgen 10'
- LOGIN="${FN,,}$(printf "%d" $RANDOM)"
- 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
-
- # Classe Entry, champs à remplir : name, description, role, linked_texts
- 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; )
- ENROLE=$(shuf -e 'geography' 'subject' 'keywords' | head -n 1)
- 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/")
- 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/")
- 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
- done
-
-
- M=$N #$(shuf -e '2' '3' '4' | head -n 1)
- for col in `eval echo {1..$M}`;
- do
- # Classe Collection, champs à remplir : title, subtitle, language, linked_director, description, publisher_note, issn
- NBLD=$(shuf -e '1' '2' '3' '4' | head -n 1)
- 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;)
- tmp=''
- for j in $directors
- do
- if [[ ! -z $tmp ]]
- then
- tmp=$(printf "$tmp, $j")
- else
- tmp=$j
- fi
- done
- COLLD=$tmp
- 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/")
- 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/")
- LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
- 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/")
- 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/")
- ISSN=$(</dev/urandom tr -dc 0-9 | head -c8;echo;)
- 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
- 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";)
- NBNUM=$(shuf -e '30' '35' '40' | head -n 1 ) # Nombre de numéros pour cette collection
-
- for i in `eval echo {1..$NBNUM}`; # On remplit les numéros
- do
- NB=$(shuf -e '25' '30' '35' '40' '45' '50' '55' '60' '65' | head -n 1) # Nombre de textes pour le numéro
- NBR=$(($NB/3)) # Nombre de reviews
- NBA=$(($NBR*2)) # Nombre d'articles
-
- # 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
- NBLD=$(shuf -e '1' '2' '3' '4' | head -n 1)
- 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;)
- tmp=''
- for j in $directors
- do
- if [[ ! -z $tmp ]]
- then
- tmp=$(printf "$tmp, $j")
- else
- tmp=$j
- fi
- done
- ISSLD=$tmp
- 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/")
- 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/")
- LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
- 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/")
- 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/")
- ISBN=$(</dev/urandom tr -dc 0-9 | head -c10;echo;)
- PISBN=$(</dev/urandom tr -dc 0-9 | head -c10;echo;)
- 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/")
- 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/")
- M=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' | head -n 1)
- 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)
- AA=$(shuf -e '2012' '2005' '2010' '2015' '2016'| head -n 1)
- PPDATE=$AA'-'$M'-'$JJ
- M=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' | head -n 1)
- 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)
- AA=$(shuf -e '2012' '2005' '2010' '2015' '2016'| head -n 1)
- EPDATE=$AA'-'$M'-'$JJ
- LNG=$(</dev/urandom tr -dc 0-9 | head -c3;echo;)
- 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/")
- ISSLPA=''
- ISSLTXT=''
- 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
- 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" )
-
- # On entre les textes correspondants aux numéros indépendemment des parts
- NBT=$(shuf -e '2' '3' '4' '5' '6' '8' | head -n 1)
- for i in `eval echo {1..$NBT}`;
- do
- # Classe Article, champs à remplir : title, subtitle, language, text, pub_date, footnotes, linked_entries, linked_persons, linked_container, abstract, appendix, bibliography, author_note
- 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/")
- 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/")
- LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
- LNG=32000; #$(</dev/urandom tr -dc 0-9 | head -c5;echo;)
- 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/")
- M=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' | head -n 1)
- 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)
- AA=$(shuf -e '2012' '2005' '2010' '2015' '2016'| head -n 1)
- ATCDATE=$AA'-'$M'-'$JJ
- LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
- 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/")
- nb=$(( ( $RANDOM % 10 ) + 1 ))
- 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;)
- tmp=""
- for i in $entries
- do
- if [[ ! -z $tmp ]]
- then
- tmp=$(printf "$tmp, $i")
- else
- tmp=$i
- fi
- done
- ATCLE=$tmp
- nb=$(( ( $RANDOM % 10 ) + 1 ))
- 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;)
- tmp=""
- for i in $persons
- do
- if [[ ! -z $tmp ]]
- then
- tmp=$(printf "$tmp, $i")
- else
- tmp=$i
- fi
- done
- ATCLP=$tmp
- ATCLC=$issue
- LNG=$(</dev/urandom tr -dc 0-9 | head -c3;echo;)
- 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/")
- LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
- 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/")
- LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
- 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/")
- LNG=$(</dev/urandom tr -dc 0-9 | head -c3;echo;)
- 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/")
- 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
- done
- NBR=$(shuf -e '0' '2' '1' | head -n 1)
- for i in `eval echo {1..$NBR}`;
- do
- # Classe Review, champs à remplir : title, subtitle, language, text, pub_date, footnotes, linked_entries, linked_persons, linked_container,reference
- 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/")
- 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/")
- LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
- LNG=32000 #$(</dev/urandom tr -dc 0-9 | head -c5;echo;)
- 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/")
- M=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' | head -n 1)
- 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)
- AA=$(shuf -e '2012' '2005' '2010' '2015' '2016'| head -n 1)
- REDATE=$AA'-'$M'-'$JJ
- LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
- 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/")
- nb=$(( ( RANDOM % 10 ) + 1 ))
- 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;)
- tmp=""
- for i in $entries
- do
- if [[ ! -z $tmp ]]
- then
- tmp=$(printf "$tmp, $i")
- else
- tmp=$i
- fi
- done
- RELE=$tmp
- nb=$(( ( RANDOM % 10 ) + 1 ))
- 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; )
- tmp=""
- for i in $persons
- do
- if [[ ! -z $tmp ]]
- then
- tmp=$(printf "$tmp, $i")
- else
- tmp=$i
- fi
- done
- RELP=$tmp
- RELC=$issue
- 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/")
- 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
- done
- NBP=$(shuf -e '2' '3' | head -n 1) # Nombre de parts en relation directe avec des issues
- for i in `eval echo {1..$NBP}`;
- do
- # 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
- NBLD=$(shuf -e '1' '2' '3' '4' | head -n 1)
- 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;)
- tmp=''
- for j in $directors
- do
- if [[ ! -z $tmp ]]
- then
- tmp=$(printf "$tmp, $j")
- else
- tmp=$j
- fi
- done
- PALD=$tmp
- 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/")
- 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/")
- LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
- 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/")
- 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/")
- 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;)
- PALTXT=''
- PALP=''
- 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
- 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" )
-
- # On entre les textes correspondants aux parts
- NBPANBT=$(shuf -e '2' '3' '4' | head -n 1)
- for i in `eval echo {1..$NBPANBT}`;
- do
- # Classe Article, champs à remplir : title, subtitle, language, text, pub_date, footnotes, linked_entries, linked_persons, linked_container, abstract, appendix, bibliography, author_note
- 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/")
- 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/")
- LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
- LNG=32000 #$(</dev/urandom tr -dc 0-9 | head -c5;echo;)
- 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/")
- M=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' | head -n 1)
- 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)
- AA=$(shuf -e '2012' '2005' '2010' '2015' '2016'| head -n 1)
- ATCDATE=$AA'-'$M'-'$JJ
- LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
- 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/")
- nb=$(( ( RANDOM % 10 ) + 1 ))
- 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;)
- tmp=""
- for i in $entries
- do
- if [[ ! -z $tmp ]]
- then
- tmp=$(printf "$tmp, $i")
- else
- tmp=$i
- fi
- done
- ATCLE=$tmp
- nb=$(( ( RANDOM % 10 ) + 1 ))
- 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;)
- tmp=""
- for i in $persons
- do
- if [[ ! -z $tmp ]]
- then
- tmp=$(printf "$tmp, $i")
- else
- tmp=$i
- fi
- done
- ATCLP=$tmp
- ATCLC=$part
- LNG=$(</dev/urandom tr -dc 0-9 | head -c3;echo;)
- 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/")
- LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
- 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/")
- LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
- 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/")
- LNG=$(</dev/urandom tr -dc 0-9 | head -c3;echo;)
- 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/")
- 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
- done
- NBPANBR=$(shuf -e '0' '1' '2' | head -n 1)
- for i in `eval echo {1..$NBPANBR}`;
- do
- # Classe Review, champs à remplir : title, subtitle, language, text, pub_date, footnotes, linked_entries, linked_persons, linked_container,reference
- 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/")
- 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/")
- LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
- LNG=32000 #$(</dev/urandom tr -dc 0-9 | head -c5;echo;)
- 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/")
- M=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' | head -n 1)
- 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)
- AA=$(shuf -e '2012' '2005' '2010' '2015' '2016'| head -n 1)
- REDATE=$AA'-'$M'-'$JJ
- LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
- 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/")
- nb=$(( ( RANDOM % 10 ) + 1 ))
- 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;)
- tmp=""
- for i in $entries
- do
- if [[ ! -z $tmp ]]
- then
- tmp=$(printf "$tmp, $i")
- else
- tmp=$i
- fi
- done
- RELE=$tmp
- nb=$(( ( RANDOM % 10 ) + 1 ))
- 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; )
- tmp=""
- for i in $persons
- do
- if [[ ! -z $tmp ]]
- then
- tmp=$(printf "$tmp, $i")
- else
- tmp=$i
- fi
- done
- RELP=$tmp
- RELC=$part
- 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/")
- 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
- done
- NBSP=$(shuf -e '0' '1' '2' '3' | head -n 1) # Nombre de parts en relation avec d'autres parts
- for i in `eval echo {1..$NBSP}`;
- do
- # 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
- NBLD=$(shuf -e '1' '2' '3' '4' | head -n 1)
- 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;)
- tmp=''
- for j in $directors
- do
- if [[ ! -z $tmp ]]
- then
- tmp=$(printf "$tmp, $j")
- else
- tmp=$j
- fi
- done
- PALD=$tmp
- 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/")
- 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/")
- LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
- 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/")
- 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/")
- PALTXT=''
- PALP=''
- 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=$part
- &field_input_linked_parts=$PALP&field_input_linked_texts=$PALTXT&classname=Part" http://$host/$instance/admin/create?classname=Part
- 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" )
-
- # On entre les textes correspondants aux numéros indépendemment des parts
- for i in `eval echo {1..$NBA}`;
- do
- # Classe Article, champs à remplir : title, subtitle, language, text, pub_date, footnotes, linked_entries, linked_persons, linked_container, abstract, appendix, bibliography, author_note
- 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/")
- 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/")
- LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
- LNG=32000 #$(</dev/urandom tr -dc 0-9 | head -c5;echo;)
- 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/")
- M=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' | head -n 1)
- 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)
- AA=$(shuf -e '2012' '2005' '2010' '2015' '2016'| head -n 1)
- ATCDATE=$AA'-'$M'-'$JJ
- LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
- 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/")
- nb=$(( ( RANDOM % 10 ) + 1 ))
- 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;)
- tmp=""
- for i in $entries
- do
- if [[ ! -z $tmp ]]
- then
- tmp=$(printf "$tmp, $i")
- else
- tmp=$i
- fi
- done
- ATCLE=$tmp
- nb=$(( ( RANDOM % 10 ) + 1 ))
- 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;)
- tmp=""
- for i in $persons
- do
- if [[ ! -z $tmp ]]
- then
- tmp=$(printf "$tmp, $i")
- else
- tmp=$i
- fi
- done
- ATCLP=$tmp
- ATCLC=$part
- LNG=$(</dev/urandom tr -dc 0-9 | head -c3;echo;)
- 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/")
- LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
- 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/")
- LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
- 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/")
- LNG=$(</dev/urandom tr -dc 0-9 | head -c3;echo;)
- 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/")
- 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
- done
- for i in `eval echo {1..$NBR}`;
- do
- # Classe Review, champs à remplir : title, subtitle, language, text, pub_date, footnotes, linked_entries, linked_persons, linked_container,reference
- 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/")
- 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/")
- LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
- LNG=32000 #$(</dev/urandom tr -dc 0-9 | head -c5;echo;)
- 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/")
- M=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' | head -n 1)
- 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)
- AA=$(shuf -e '2012' '2005' '2010' '2015' '2016'| head -n 1)
- REDATE=$AA'-'$M'-'$JJ
- LNG=$(</dev/urandom tr -dc 0-9 | head -c4;echo;)
- 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/")
- nb=$(( ( RANDOM % 10 ) + 1 ))
- 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;)
- tmp=""
- for i in $entries
- do
- if [[ ! -z $tmp ]]
- then
- tmp=$(printf "$tmp, $i")
- else
- tmp=$i
- fi
- done
- RELE=$tmp
- nb=$(( ( RANDOM % 10 ) + 1 ))
- 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; )
- tmp=""
- for i in $persons
- do
- if [[ ! -z $tmp ]]
- then
- tmp=$(printf "$tmp, $i")
- else
- tmp=$i
- fi
- done
- RELP=$tmp
- RELC=$issue
- 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/")
- 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
- done
- done
- done
- done
- done
|