LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-23-2016, 04:34 AM   #46
ravishchugh
Member
 
Registered: Sep 2015
Posts: 54

Original Poster
Rep: Reputation: 0

Quote:
Originally Posted by tshikose View Post
Hi,

So, you should have a shell script called backup.sh with content similar to the below.
#!/bin/sh
su - postgres -c "rm -rf /var/lib/pgsql/9.4/data/*"
su - postgres -c "pg_basebackup -h 192.XX.XX.XX -U postgres -D /var/lib/pgsql/9.4/data -X stream -P"
su - postgres -c "rm /var/lib/pgsql/tmp/PGSQL.lock"
pcs resource cleanup msPostgresql

Then have backup.sh called in a root cron job.

Please test it thoroughly, and modify it accordingly, before putting in production.
U saved the day for me sir, its working perfectly

Now, how do i use a cron job for this...will it be executed on every reboot or is there a custom way out for it??

Regards
 
Old 05-23-2016, 07:57 AM   #47
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 525

Rep: Reputation: 95
Hi,

I know you have already read and eaten up a lot, but you need to read more.

Cron jobs can be executed a regular interval (down to the minutes).
man 5 crontab is what you need.
Recent versions of cronie package avail extensions such as @reboot, that combine with a sleep command up front can run at every boot with decent delay for initialization.
 
  


Reply

Tags
database, replication



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: High Availability - Real Time Data Replication Across Multiple Nodes using GlusterFS On Centos LXer Syndicated Linux News 0 05-22-2013 07:01 PM
LXer: How To Install Repcached (Memcached Replication) For High-Availability Over 2 Nodes On Ubuntu LXer Syndicated Linux News 0 09-30-2011 12:30 PM
How to build a redundant, high-availability File Server system manya Linux - Server 3 03-24-2010 05:07 AM
[SOLVED] Linux high performance and high availability clustering Blue_Ice Linux - Software 2 03-27-2009 04:49 AM
Replication + High Availability !! varungupta_82 Linux - General 0 02-28-2004 01:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration