From 8ca66c10ad84fb7884123b8174598ba77a03ec17 Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Wed, 26 Apr 2023 09:26:46 +0200 Subject: [PATCH] Add more repair commands and use tty for occ --- templates/script/restart-nextcloud-farm.erb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/templates/script/restart-nextcloud-farm.erb b/templates/script/restart-nextcloud-farm.erb index 4b68f5f..622b2ca 100755 --- a/templates/script/restart-nextcloud-farm.erb +++ b/templates/script/restart-nextcloud-farm.erb @@ -72,7 +72,10 @@ def main() -> int: 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 config:editable --off' - repair_command = 'sudo /usr/local/bin/occ maintenance:repair' + repair_command = 'sudo /usr/local/bin/occ maintenance:repair ' + repair_command += '&& sudo /usr/local/bin/occ db:add-missing-indices ' + repair_command += '&& sudo /usr/local/bin/occ db:add-missing-columns ' + repair_command += '&& sudo /usr/local/bin/occ db:add-missing-primary-keys' reboot_command = ['sudo /usr/local/bin/safer_reboot'] server_type = "node" if customer == "common": @@ -116,9 +119,9 @@ def main() -> int: return 6 fqdn = build_fqdn(customer, environment, 3, server_type) print("Running nextcloud upgrade command at {}".format(fqdn)) - run_remote_command(fqdn, [nc_upgrade_command], user="script") + run_remote_command(fqdn, [nc_upgrade_command], user="script", tty=True) print("Running repair command on {}".format(fqdn)) - run_remote_command(fqdn, [repair_command], user="script") + run_remote_command(fqdn, [repair_command], user="script", tty=True) print("All {}-servers successfully upgraded for {}".format( environment, customer))