Automated Data Backup on Reference Platforms

Copy the file bu.sh from the folder /usr/tomcat/webappd/da/WEB-INF into the folder /root and follow the instructions contained therein. This process is tested to work on reference operating system and database platforms, as described in Installing on Reference Platforms. For other platforms, you may need to make necessary changes or choose another suitable method.

Here is the listing of bu.sh

ID="ap7.dreamapps.com"
DEST="ds1184@bu.dreamapps.com"
DIR="bu"
#########################################################
#               BACKING UP THE DATABASE                 #
#               =======================                 #
#        NOTE: ^ indicates a space in a command.        #
#                                                       #
# (1) Log In as root and copy this file in to the /root #
#     directory of the server you want to back up by    #
#          cp^/usr/tomcat/webapps/da/WEB-INF/bu.sh^.    #
#                                                       #
#     Don't forget the space and the dot(.) after bu.sh #
#                                                       #
# (2) Grant execution permission by the command         #
#          chmod^u+x^/root/bu.sh                        #
#                                                       #
# (3) You MUST CHANGE the value of ID for each server   #
#     and optionally change DEST and DIR, if needed,    #
#     where                                             #
#       ID is the description of this server,           #
#       DEST is user-id and address of the destination, # 
#       DIR is the destination directory.               #
#                                                       #
#     The destination server must have the folders      #
#     .ssh and bu in its default directory, like        #
#                                                       #
#         /home/ds1184/.ssh and /home/ds1184/bu         #
#                                                       #
#       *****************************************       #
#       * DON'T CHANGE ANYTHING BELOW THIS BOX! *       #
#       *****************************************       #
#                                                       #
# (4) Before you can use this script, you must generate #
#     the ssh keys, as follows                          #
#         ssh-keygen^-t^dsa                             #
#                                                       #
#     and then upload it to the backup server           #
#         ssh-copy-id^-i^.ssh/id_dsa.pub^<destination>  #
#                                                       #
#     Replace <destination> with the value of $DEST     #
#     above, like                                       #
#          ds1184@test.dreamapps.com                    #
#                                                       #
#       *****************************************       #
#       * Press ENTER in reply to all prompts.  *       #
#       *****************************************       #
#                                                       #
# (5) To automate backup, make a crontab entry like     #
#         crontab^-e                                    #
#         30^4^*^*^*^/root/bu.sh                        #
#                                                       #
#     The above will cause daily backup at 4:30am.      #
#     To list any existing entry, use                   #
#         crontab -l                                    #
#     For complex backup set up see cron and crontab    #
#     documentation.                                    #
#                                                       #
#########################################################
BU=$ID.`date +"%y%m%d"`.zip
su - postgres -c "pg_dumpall " > /var/lib/pgsql/pgall.bu
zip $BU /var/lib/pgsql/pgall.bu >> bu.log
rsync --progress -avvvze ssh --delete $BU $DEST:$DIR/ >> bu.log