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
           | 
      
      
        
  | Line |   | 
|---|
| 1 | #!/bin/bash -e | 
|---|
| 2 |  | 
|---|
| 3 | author="$USER warehouse-refresh.sh on $(hostname) <asa-db@mit.edu>" | 
|---|
| 4 | basedir="$(dirname "$(readlink -f "$0")")" | 
|---|
| 5 | database="$("$basedir/../settings/fetch" database NAME)" | 
|---|
| 6 |  | 
|---|
| 7 | date | 
|---|
| 8 |  | 
|---|
| 9 | cd "$basedir/saved-data" | 
|---|
| 10 |  | 
|---|
| 11 | mysqldump --skip-extended-insert "$database" > data.sql | 
|---|
| 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: | 
|---|
| 19 | git show --stat | 
|---|
| 20 |  | 
|---|
| 21 | echo | 
|---|
| 22 | echo | 
|---|
| 23 | echo Performing replacement | 
|---|
| 24 | echo "TRUNCATE TABLE groups_group" | mysql "$database" | 
|---|
| 25 | ../import_db.py < ../warehouse-dump.csv > /dev/null | 
|---|
| 26 | mysqldump --skip-extended-insert "$database" > data.sql | 
|---|
| 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: | 
|---|
| 34 | git show --stat | 
|---|
| 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.