Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

How To move Postgresql archive log with tar fomat ? script

Ans:
In this shell script will move and compress the  Postgresql archive log to backup location, you can shedule it in crontab and change environment variable as per your firm 
PGDATA=/data/
PGHOME=/opt/PostgreSQL/9.5/bin
HOT=/backup
WAL_LOC=/archive/
LOG=/home/postgres/cron_script_logs
PGDATABASE=postgres
PGUSER=postgres
PGPORT=5432
TODAY=$(date +"%m-%d-%Y-%T")
echo "Archive backup Start Time: `date +%d-%m-%y-%T`" >> $LOG/archiveinfo_$TODAY.log
/opt/PostgreSQL/9.5/bin/psql -U $PGUSER -d $PGDATABASE -p $PGPORT -c "select pg_switch_xlog();" >> $LOG/archiveinfo_$TODAY.log
tar --remove-files -cvzf $HOT/arch_$TODAY.tar.gz $WAL_LOC/* >> $LOG/archiveinfo_$TODAY.log
echo "Archive backup End Time: `date +%d-%m-%y-%T`" >> $LOG/archiveinfo_$TODAY.log
exit 0

Comments

Popular posts from this blog

VMWARE WORKSTATION 3,4,5,6,7,8,9,10,11,12,14,15...etc LICENSE KEYS COLLECTION

Top 10 Highest Paying URL Shortener Companies - Best URL Shorteners To Earn Fast

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

aireplay-ng

2017 Shortern URL - Other Website Like ADFOC.US