76- Daily backup schedule using pg_dumpall

preview_player
Показать описание
( 24*7) on Call Support for PostgreSQL/Open Source databases.
***********************************************************************************************

***********************************************************************************************
PostgreSQL support starting from 100 USD/Hr ( 24*7)
***********************************************************************************************
Рекомендации по теме
Комментарии
Автор

#THE CODE modified
echo "the script will backup all dbs on hostname"




mkdir -p $Backup_dir

retentation_period=7
+%d-%m-%Y_%H-%M-%S).sql
+%d-%m-%Y_%H-%M-%S).zip
#create backup folder
find $Backup_dir -mtime +$retentation_period -delete

# Create a backup
if pg_dumpall > $backupdump ; then
echo 'Sql dump created'
else
echo 'pg_dump return non-zero code'
exit
fi
# Compress backup
if gzip -c $backupdump > $zipfile; then
echo 'The backup was successfully compressed'
else
echo 'Error compressing backup'
exit
fi
rm -rf $backupdump

AnteUjcic