#!/bin/bash

PATH=/usr/local/bin:/usr/bin:/bin
HOME=/home/Administrator
source ~/.bashrc

mkdir c:/backup_jm
if [ -e "c:/backup_jm" ];
then
 rm -f c:/backup_jm/*
 pg_dump -Ft kddm_jm > c:/backup_jm/kddm_jm.tar
 pg_dump -a -Ft -t relations kddm_jm > c:/backup_jm/relations.tar
 pg_dump -a -Ft -t c_status kddm_jm > c:/backup_jm/c_status.tar
 pg_dump -a -Ft -t r_status kddm_jm > c:/backup_jm/r_status.tar
 pg_dump -a -Ft -t sys_config kddm_jm > c:/backup_jm/sys_config.tar
 pg_dump -a -Ft -t r_version kddm_jm > c:/backup_jm/r_version.tar
fi
rm -f $JM_ROOT_UNX/backup/*
pg_dump -Ft kddm_jm > $JM_ROOT_UNX/backup/kddm_jm.tar
pg_dump -a -Ft -t relations kddm_jm > $JM_ROOT_UNX/backup/relations.tar
pg_dump -a -Ft -t c_status kddm_jm > $JM_ROOT_UNX/backup/c_status.tar
pg_dump -a -Ft -t r_status kddm_jm > $JM_ROOT_UNX/backup/r_status.tar
pg_dump -a -Ft -t sys_config kddm_jm > $JM_ROOT_UNX/backup/sys_config.tar
pg_dump -a -Ft -t r_version kddm_jm > $JM_ROOT_UNX/backup/r_version.tar
