Allow to rewrite archive_command in sample scripts.
authorBo Peng <pengbo@sraoss.co.jp>
Sun, 5 Jun 2022 13:45:21 +0000 (22:45 +0900)
committerBo Peng <pengbo@sraoss.co.jp>
Sun, 5 Jun 2022 13:47:18 +0000 (22:47 +0900)
src/sample/scripts/follow_primary.sh.sample
src/sample/scripts/recovery_1st_stage.sample
src/sample/scripts/replication_mode_recovery_1st_stage.sample

index 3c7c88d6fac1e36f81e45bb0c05d6d24b4fd7894..c686b19a4fc73f0a2f595119230da2a0d50f89a5 100755 (executable)
@@ -133,7 +133,10 @@ EOT
         else
             echo \"standby_mode = 'on'\" >> ${RECOVERYCONF}
         fi
-        sed -i -e \"s/#*port = .*/port = ${NODE_PORT}/\" ${NODE_PGDATA}/postgresql.conf
+        sed -i \
+            -e \"s/#*port = .*/port = ${NODE_PORT}/\" \
+            -e \"s@#*archive_command = .*@archive_command = 'cp \\\"%p\\\" \\\"${ARCHIVEDIR}/%f\\\"'@\" \
+            ${NODE_PGDATA}/postgresql.conf
     "
 
     if [ $? -ne 0 ]; then
index c01001c652c3df4338c6aca85c7c413eab3151d3..c671fa39d640e5fcfe81a7621d2c8d228f164ce5 100755 (executable)
@@ -69,7 +69,10 @@ EOT
         echo \"standby_mode = 'on'\" >> ${RECOVERYCONF}
     fi
 
-    sed -i \"s/#*port = .*/port = ${DEST_NODE_PORT}/\" ${DEST_NODE_PGDATA}/postgresql.conf
+    sed -i \ 
+        -e \"s/#*port = .*/port = ${DEST_NODE_PORT}/\" \
+        -e \"s@#*archive_command = .*@archive_command = 'cp \\\"%p\\\" \\\"${ARCHIVEDIR}/%f\\\"'@\" \
+        ${DEST_NODE_PGDATA}/postgresql.conf
 "
 
 if [ $? -ne 0 ]; then
index 7bcd5f3affb253cf3023e7f076fa74904bc98d61..999766f741057c5cfe3fdb06482567f7f7dfd8a7 100755 (executable)
@@ -60,7 +60,10 @@ EOT
         echo \"standby_mode = 'on'\" >> ${RECOVERYCONF}
     fi
 
-    sed -i \"s/#*port = .*/port = ${DEST_NODE_PORT}/\" ${DEST_NODE_PGDATA}/postgresql.conf
+    sed -i \
+        -e \"s/#*port = .*/port = ${DEST_NODE_PORT}/\" \
+        -e \"s@#*archive_command = .*@archive_command = 'cp \\\"%p\\\" \\\"${ARCHIVEDIR}/%f\\\"'@\" \
+        ${DEST_NODE_PGDATA}/postgresql.conf
 "
 
 if [ $? -ne 0 ]; then