space-accessstablestage
        
      
        
          | 
                Last change
                  on this file was
                  2ca19cb,
                  checked in by MIT Association of Student Activities <asa@…>, 14 years ago
           | 
        
        
          | 
               
Allow running warehouse-refresh.sh from anywhere 
 
           | 
        
        
          
            
              - 
                  Property mode set to
                  
100755
               
             
           | 
        
        | 
            File size:
            992 bytes
           | 
      
      
        
  | Rev | Line |   | 
|---|
| [14e96b3] | 1 | #!/bin/bash -e | 
|---|
 | 2 |  | 
|---|
 | 3 | author="$USER warehouse-refresh.sh on $(hostname) <asa-db@mit.edu>" | 
|---|
| [774f999] | 4 | basedir="$(dirname "$(readlink -f "$0")")" | 
|---|
 | 5 | database="$("$basedir/../settings/fetch" database NAME)" | 
|---|
| [14e96b3] | 6 |  | 
|---|
 | 7 | date | 
|---|
 | 8 |  | 
|---|
| [2ca19cb] | 9 | cd "$basedir/saved-data" | 
|---|
| [14e96b3] | 10 |  | 
|---|
| [774f999] | 11 | mysqldump --skip-extended-insert "$database" > data.sql | 
|---|
| [14e96b3] | 12 |  | 
|---|
 | 13 | echo | 
|---|
 | 14 | echo Committing previous DB: | 
|---|
 | 15 | git commit data.sql -m "Previous ASA database: $(date +%F)" --allow-empty --author="$author" | 
|---|
 | 16 |  | 
|---|
 | 17 | echo | 
|---|
 | 18 | echo Changes in this commit: | 
|---|
| [5c77dea] | 19 | git show --stat | 
|---|
| [14e96b3] | 20 |  | 
|---|
 | 21 | echo | 
|---|
 | 22 | echo | 
|---|
 | 23 | echo Performing replacement | 
|---|
| [774f999] | 24 | echo "TRUNCATE TABLE groups_group" | mysql "$database" | 
|---|
| [14e96b3] | 25 | ../import_db.py < ../warehouse-dump.csv > /dev/null | 
|---|
| [774f999] | 26 | mysqldump --skip-extended-insert "$database" > data.sql | 
|---|
| [14e96b3] | 27 |  | 
|---|
 | 28 | echo | 
|---|
 | 29 | echo Committing new DB: | 
|---|
 | 30 | git commit data.sql -m "New ASA database: $(date +%F)" --allow-empty --author="$author" | 
|---|
 | 31 |  | 
|---|
 | 32 | echo | 
|---|
 | 33 | echo Changes in this commit: | 
|---|
| [5c77dea] | 34 | git show --stat | 
|---|
| [14e96b3] | 35 |  | 
|---|
 | 36 | echo | 
|---|
 | 37 | echo | 
|---|
 | 38 | echo Disk usage: | 
|---|
 | 39 | du -h --max-depth=1 | 
|---|
 | 40 |  | 
|---|
 | 41 | echo | 
|---|
 | 42 | echo "gc'ing..." | 
|---|
 | 43 | time git gc | 
|---|
 | 44 | echo "repack'ing..." | 
|---|
 | 45 | time git repack | 
|---|
 | 46 |  | 
|---|
 | 47 | echo | 
|---|
 | 48 | echo Disk usage: | 
|---|
 | 49 | du -h --max-depth=1 | 
|---|
 | 50 |  | 
|---|
 | 51 | date | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.