Allways backup the db

This commit is contained in:
Micke Nordin 2023-09-02 12:30:16 +02:00
parent c7bd0fa965
commit 7207ef2bbf
Signed by untrusted user: Micke
GPG key ID: 0DA0A7A5708FE257

View file

@ -68,6 +68,7 @@ def main() -> int:
apikey_test = "<%= @apikey_test %>" apikey_test = "<%= @apikey_test %>"
apikey_prod = "<%= @apikey_prod %>" apikey_prod = "<%= @apikey_prod %>"
backup_command = ['sudo /home/script/bin/backup_db.sh']
cosmos_command = ['sudo run-cosmos'] cosmos_command = ['sudo run-cosmos']
nc_upgrade_command = 'sudo /usr/local/bin/occ config:editable --on ' nc_upgrade_command = 'sudo /usr/local/bin/occ config:editable --on '
nc_upgrade_command += '&& sudo /usr/local/bin/occ upgrade ' nc_upgrade_command += '&& sudo /usr/local/bin/occ upgrade '
@ -80,9 +81,18 @@ def main() -> int:
repair_command += '&& sudo /usr/local/bin/occ db:add-missing-primary-keys' repair_command += '&& sudo /usr/local/bin/occ db:add-missing-primary-keys'
reboot_command = ['sudo /usr/local/bin/safer_reboot'] reboot_command = ['sudo /usr/local/bin/safer_reboot']
server_type = "node" server_type = "node"
backup_type = "backup"
if customer == "common": if customer == "common":
customer = "gss" customer = "gss"
server_type = "gss" server_type = "gss"
backup_type = "gssbackup"
backup = build_fqdn(customer, environment, 1, backup_type)
print("\tRunning backup command at {}".format(backup))
run_remote_command(backup,
backup_command,
user="script",
output=subprocess.DEVNULL)
for number in reversed(range(1, 4)): for number in reversed(range(1, 4)):
fqdn = build_fqdn(customer, environment, number, server_type) fqdn = build_fqdn(customer, environment, number, server_type)