#echo "start backup database: postgres"
#${backup_command} -Fc postgres > ${backup_folder}${DATE}/postgres.${DATETIME}.bak
echo "Start backup time: $(date '+%Y-%m-%d %H:%M:%S')";
for loop in `/usr/local/bin/psql postgres -c "SELECT datname FROM pg_database;"`
do
FLAGSTR=`echo $loop | cut -c1-1`
if [ "'$loop'" = "'datname'" ]; then
continue;
elif
[ "'$loop'" = "'template0'" ]; then
continue;
elif
[ "'$FLAGSTR'" = "'-'" ]; then
continue;
elif
[ "'$FLAGSTR'" = "'('" ]; then
echo "backup complete";
exit 0;
else
echo "start backup database: $loop";
${backup_command} ${loop} > ${backup_folder}${DATE}/${loop}.${DATETIME}.bak;
fi
done