/[Sack]/trunk/bin/cloud.sh
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/bin/cloud.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 61 by dpavlin, Fri Sep 25 13:15:13 2009 UTC revision 65 by dpavlin, Fri Sep 25 14:01:48 2009 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/sh
2    
3  port=3000  port=4000
4  offset=0  offset=0
5  limit=25000  limit=25000
6  connect=  connect=
7    
8    v=
9    
10    #v='-v'
11    limit=500
12    
13  hostname=`hostname -s`  hostname=`hostname -s`
14    
15  update=$1  update=$1
16    
17    prefix=`pwd | sed 's!/*/srv/Sack.*$!!'`
18    
19  function node {  function node {
20    
21          if [ ! -z "$update" ] ; then          if [ ! -z "$update" ] ; then
22                  echo "update $1:$2"                  echo "# update $1:$2 from $prefix"
23                    rsync -rav --exclude 'out/*'                   $prefix/srv/Sack/    $1:/$2/srv/Sack/
24                    rsync -rav --exclude 'out/*' --exclude 'var/*' $prefix/srv/webpac2/ $1:/$2/srv/webpac2/
25                  ssh $1 $2/srv/Sack/bin/install-debian.sh || exit                  ssh $1 $2/srv/Sack/bin/install-debian.sh || exit
26                  ssh $1 killall sack.pl                  ssh $1 killall sack.pl
                 rsync -rav --exclude 'out/*' /virtual/webpac2.rot13.org/export/srv/Sack/ $1:/$2/srv/Sack/  
                 rsync -rav --exclude 'out/*' --exclude 'var/*' /virtual/webpac2.rot13.org/export/srv/webpac2/ $1:/$2/srv/webpac2/  
27          fi          fi
28    
29          ssh="ssh -L $port:localhost:$port $1"          ssh="ssh -L $port:127.0.0.1:$port $1"
30          test "$hostname" == $1 && ssh=""          test "$hostname" == $1 && ssh=""
31    
32          echo "## $1 $port $offset $limit [$ssh]"          echo "# node $1 [$ssh] $offset $limit"
33    
34          $ssh $2/srv/Sack/bin/sack.pl --listen $port --limit $limit --offset $offset &          echo 0 exit | nc localhost $port
         connect="$connect --connect 127.0.0.1:$port"  
35    
36          sleep 1          $ssh $v $2/srv/Sack/bin/sack.pl --listen $port --limit $limit --offset $offset &
37            connect="$connect --connect $port"
38    
39          port=`expr $port + 1`          port=`expr $port + 1`
40          offset=`expr $offset + $limit`          offset=`expr $offset + $limit`
41  }  }
42    
43    rm /dev/shm/sack.*
44    
45  node mlin /virtual/webpac2.rot13.org/export/  if [ $hostname == 't61p' ] ; then
46  node mlin /virtual/webpac2.rot13.org/export/          node tab /
47  node opr  /virtual/webpac2.rot13.org/export/  else
48  node opr  /virtual/webpac2.rot13.org/export/          echo "# .lib";
49  #node klin /virtual/webpac2.rot13.org/export/          node mlin /virtual/webpac2.rot13.org/export/
50            node mlin /virtual/webpac2.rot13.org/export/
51            node opr  /virtual/webpac2.rot13.org/export/
52  echo "## lorry $connect"          node opr  /virtual/webpac2.rot13.org/export/
53  cd /virtual/webpac2.rot13.org/export/srv/Sack ; ./bin/sack.pl $connect --limit $limit --offset $offset          node klin /virtual/webpac2.rot13.org/export/
54    fi
55    
56    
57    echo "## lorry wating..."
58    sleep 1
59    echo "## ... $connect";
60    cd $prefix/srv/Sack ; ./bin/sack.pl $connect --limit $limit --offset $offset

Legend:
Removed from v.61  
changed lines
  Added in v.65

  ViewVC Help
Powered by ViewVC 1.1.26