|
@@ -1,63 +0,0 @@
|
1
|
|
-#!/bin/bash
|
2
|
|
-
|
3
|
|
-host=$1
|
4
|
|
-instance=$2
|
5
|
|
-N=$3
|
6
|
|
-HOSTDB=localhost
|
7
|
|
-
|
8
|
|
-M=$(expr $N / 10)
|
9
|
|
-for i in `eval echo {1..$M}`;
|
10
|
|
-do
|
11
|
|
- COLPUBLI=""
|
12
|
|
- COLT=$(lenmax=100;wcount=5; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
13
|
|
- curl -A "Mozilla/5.0" -L -s -d "field_input_title=$COLT&field_input_publications=$COLPUBLI&classname=Collection" http://$host/$instance/admin/create?classname=Collection
|
14
|
|
- 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/")
|
15
|
|
- 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/")
|
16
|
|
- curl -A "Mozilla/5.0" -L -s -d "field_input_lastname=$LN&field_input_firstname=$FN&classname=Person" http://$host/$instance/admin/create?classname=Person
|
17
|
|
- PWD='pwgen 10'
|
18
|
|
- LOGIN="${FN,,}$(printf "%d" $RANDOM)"
|
19
|
|
- curl -A "Mozilla/5.0" -L -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
|
20
|
|
-done
|
21
|
|
-
|
22
|
|
-M=$(expr $N / 4)
|
23
|
|
-for i in `eval echo {1..$M}`;
|
24
|
|
-do
|
25
|
|
- persons=$(printf "use lodel2_$instance\n db.Person.find({}, {lodel_id:1, _id:0}).limit(3)" | mongo $HOSTDB/admin -u lodel2_admin -p lapwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d")
|
26
|
|
- tmp=""
|
27
|
|
- for i in $persons
|
28
|
|
- do
|
29
|
|
- if [[ ! -z $tmp ]]
|
30
|
|
- then
|
31
|
|
- tmp=$(printf "$tmp, $i")
|
32
|
|
- else
|
33
|
|
- tmp=$i
|
34
|
|
- fi
|
35
|
|
- done
|
36
|
|
- SECLP=$tmp
|
37
|
|
- SECST=$(lenmax=60;wcount=10; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
38
|
|
- SECTTL=$(lenmax=60;wcount=5; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
39
|
|
- curl -A "Mozilla/5.0" -L -s -d "field_input_linked_persons=$SECLP&field_input_subtitle=$SECSTD&field_input_title=$SECTTL&classname=Section" http://$host/$instance/admin/create?classname=Section
|
40
|
|
-done
|
41
|
|
-
|
42
|
|
-for i in `eval echo {1..$N}`;
|
43
|
|
-do
|
44
|
|
- persons=$(printf "use lodel2_$instance\n db.Person.find({}, {lodel_id:1, _id:0}).limit(3)" | mongo $HOSTDB/admin -u lodel2_admin -p lapwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d")
|
45
|
|
- for i in $persons
|
46
|
|
- do
|
47
|
|
- if [[ ! -z $tmp ]]
|
48
|
|
- then
|
49
|
|
- tmp=$(printf "$tmp, $i")
|
50
|
|
- else
|
51
|
|
- tmp=$i
|
52
|
|
- fi
|
53
|
|
- done
|
54
|
|
- SSSECLP=$tmp
|
55
|
|
- SSSECST=$(lenmax=60;wcount=10; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
56
|
|
- res=$(printf "use lodel2_$instance\n db.Section.find({}, {lodel_id:1, _id:0}).limit(1)" | mongo $HOSTDB/admin -u lodel2_admin -p lapwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d")
|
57
|
|
- SSSECPAR=$res
|
58
|
|
- SSSECTTL=$(lenmax=60;wcount=5; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
59
|
|
- res=$(printf "use lodel2_$instance\n db.Collection.find({}, {lodel_id:1, _id:0}).limit(1)" | mongo $HOSTDB/admin -u lodel2_admin -p lapwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d")
|
60
|
|
- PUBCOLLS=$res
|
61
|
|
- curl -A "Mozilla/5.0" -L -s -d "field_input_linked_persons=$SSSECLP&field_input_subtitle=$SSSECST&field_input_parent=$SSSECPAR&field_input_title=$SSSECTTL&classname=Subsection" http://$host/$instance/admin/create?classname=Subsection
|
62
|
|
- curl -A "Mozilla/5.0" -L -s -d "field_input_collection=$PUBCOLLS&classname=Publication" http://$host/$instance/admin/create?classname=Publication
|
63
|
|
-done
|