* Store the body of any large (>1K) message in a separate database. This
[citadel.git] / citadel / database_cleanup.sh
1 #!/bin/bash
2
3 clear
4 cat <<!
5
6 Citadel/UX Database Cleanup
7 ---------------------------
8
9 This script exports, deletes, and re-imports your database.  If you have
10 any data corruption issues, this program may be able to clean them up for you.
11  
12 Please note that this program does a Berkeley DB dump/load, not a Citadel
13 export.  The export files are not generated by the Citadel export module.
14
15 MAKE A BACKUP OF YOUR DATA BEFORE ATTEMPTING THIS.  There is no guarantee
16 that this will work!
17
18 !
19
20 echo -n "Do you want to continue? "
21
22 read yesno
23 case "$yesno" in
24         "y" | "Y" | "yes" | "YES" | "Yes" )
25                 echo 
26                 echo DO NOT INTERRUPT THIS PROCESS.
27                 echo
28         ;;
29         * )
30                 exit
31 esac
32
33 for x in 00 01 02 03 04 05 06 07 08
34 do
35         filename=cdb.$x
36         echo Dumping $filename
37         db_dump -h ./data $filename >/tmp/CitaDump.$x
38         rm -f ./data/$filename
39 done
40
41 echo Removing log files
42 rm -f ./data/*
43
44 for x in 00 01 02 03 04 05 06 07 08
45 do
46         filename=cdb.$x
47         echo Loading $filename
48         db_load -h ./data $filename </tmp/CitaDump.$x
49         rm -f /tmp/CitaDump.$x
50 done
51
52 echo 
53 echo Dump/load operation complete.  Start your Citadel server now.
54 echo