/[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 62 by dpavlin, Fri Sep 25 13:16:04 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    v='-v'
10    
11  hostname=`hostname -s`  hostname=`hostname -s`
12    
13  update=$1  update=$1
14    
15    prefix=`pwd | sed 's!/*/srv/Sack.*$!!'`
16    
17  function node {  function node {
18    
19          if [ ! -z "$update" ] ; then          if [ ! -z "$update" ] ; then
20                  echo "update $1:$2"                  echo "# update $1:$2 from $prefix"
21                    rsync -rav --exclude 'out/*'                   $prefix/srv/Sack/    $1:/$2/srv/Sack/
22                    rsync -rav --exclude 'out/*' --exclude 'var/*' $prefix/srv/webpac2/ $1:/$2/srv/webpac2/
23                  ssh $1 $2/srv/Sack/bin/install-debian.sh || exit                  ssh $1 $2/srv/Sack/bin/install-debian.sh || exit
24                  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/  
25          fi          fi
26    
27          ssh="ssh -L $port:localhost:$port $1"          ssh="ssh -L $port:127.0.0.1:$port $1"
28          test "$hostname" == $1 && ssh=""          test "$hostname" == $1 && ssh=""
29    
30          echo "## $1 $port $offset $limit [$ssh]"          echo "# node $1 [$ssh] $offset $limit"
31    
32          $ssh $2/srv/Sack/bin/sack.pl --listen $port --limit $limit --offset $offset &          $ssh $v $2/srv/Sack/bin/sack.pl --listen $port --limit $limit --offset $offset &
33          connect="$connect --connect 127.0.0.1:$port"          connect="$connect --connect 127.0.0.1:$port"
34    
         sleep 1  
   
35          port=`expr $port + 1`          port=`expr $port + 1`
36          offset=`expr $offset + $limit`          offset=`expr $offset + $limit`
37  }  }
38    
39    if [ $hostname == 't61p' ] ; then
40  node mlin /virtual/webpac2.rot13.org/export/          node tab /
41  node mlin /virtual/webpac2.rot13.org/export/  else
42  node opr  /virtual/webpac2.rot13.org/export/          echo "# .lib";
43  node opr  /virtual/webpac2.rot13.org/export/          node mlin /virtual/webpac2.rot13.org/export/
44  #node klin /virtual/webpac2.rot13.org/export/          node mlin /virtual/webpac2.rot13.org/export/
45            node opr  /virtual/webpac2.rot13.org/export/
46            node opr  /virtual/webpac2.rot13.org/export/
47  echo "## lorry $connect"          node klin /virtual/webpac2.rot13.org/export/
48  cd /virtual/webpac2.rot13.org/export/srv/Sack ; ./bin/sack.pl $connect --limit $limit --offset $offset  fi
49    
50    
51    echo "## lorry wating..."
52    sleep 1
53    echo "## ... $connect";
54    cd $prefix/srv/Sack ; ./bin/sack.pl $connect --limit $limit --offset $offset

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

  ViewVC Help
Powered by ViewVC 1.1.26