From 2cb27a9f32fa729e077b51ed22579ab412a9fbee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20M=C3=B6hlmann?= Date: Fri, 30 Nov 2018 17:43:03 +0200 Subject: [PATCH] Fix sorting of /backup/base-* directories --- optional/postgresql/start.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/optional/postgresql/start.py b/optional/postgresql/start.py index 7049e687..ea278d56 100755 --- a/optional/postgresql/start.py +++ b/optional/postgresql/start.py @@ -32,10 +32,10 @@ def setup(): if not os.listdir("/data"): os.system("chown -R postgres:postgres /data") os.system("chmod 0700 /data") - base_backups=glob.glob("/backup/base-*") + base_backups=sorted(glob.glob("/backup/base-*")) if base_backups: # Restore the latest backup - subprocess.call(["tar", "--same-owner", "-zpxvf", base_backups[-1] + "/base.tar.gz" , "-C", "/data"]) + subprocess.call(["tar", "--same-owner", "-zpxf", base_backups[-1] + "/base.tar.gz" , "-C", "/data"]) if os.listdir("/backup/wal_archive"): with open("/data/recovery.conf", "w") as rec: rec.write("restore_command = 'cp /backup/wal_archive/%f %p'\n")