diff --git a/software/slaprunner/common.cfg b/software/slaprunner/common.cfg index 681cbb6d8e56ab3fbc3a14e19cdeb7282e9cdd33..afe191e872620dcc10be75d21acdc106fae7f41a 100644 --- a/software/slaprunner/common.cfg +++ b/software/slaprunner/common.cfg @@ -62,7 +62,7 @@ recipe = hexagonit.recipe.download ignore-existing = true url = ${:_profile_base_location_}/template/runner-import.sh.jinja2 download-only = true -md5sum = d7f88b58b2508ce5af42ea7d7241626e +md5sum = f1fea38763883de5214e898068c30841 filename = runner-import.sh.jinja2 mode = 0644 @@ -70,7 +70,7 @@ mode = 0644 recipe = slapos.recipe.template url = ${:_profile_base_location_}/instance-runner-import.cfg.in output = ${buildout:directory}/instance-runner-import.cfg -md5sum = 341e1273f9489d60520c3bbaef72e1f4 +md5sum = 5217b9157c3691c069a95dd2d487e703 mode = 0644 [template-runner-export-script] @@ -78,7 +78,7 @@ recipe = hexagonit.recipe.download ignore-existing = true url = ${:_profile_base_location_}/template/runner-export.sh.jinja2 download-only = true -md5sum = 1bfe048194d4478d0d8743e43e72f7d8 +md5sum = 491fb665bf5a5a2dc80bf912aee1a844 filename = runner-export.sh.jinja2 mode = 0644 @@ -86,7 +86,7 @@ mode = 0644 recipe = slapos.recipe.template url = ${:_profile_base_location_}/instance-runner-export.cfg.in output = ${buildout:directory}/instance-runner-export.cfg -md5sum = c4c1c2059666e30b715e87509d2a0db7 +md5sum = 2a962c3256d7d5ba31a4ffe7650a80f5 mode = 0644 [template-resilient] diff --git a/software/slaprunner/instance-runner-export.cfg.in b/software/slaprunner/instance-runner-export.cfg.in index 7e0f745f0f195789aac748411e4ec46c62d5d185..4f05430bd1503133839ef566d2a77d74c78b139a 100644 --- a/software/slaprunner/instance-runner-export.cfg.in +++ b/software/slaprunner/instance-runner-export.cfg.in @@ -70,7 +70,8 @@ wrapper = $${:rendered} mode = 700 context = section directory directory - raw shell_binary ${dash:location}/bin/dash + raw output_log_file $${directory:log}/resilient.log + raw shell_binary ${bash:location}/bin/bash raw rsync_binary ${rsync:location}/bin/rsync [monitor-httpd-free-port] diff --git a/software/slaprunner/instance-runner-import.cfg.in b/software/slaprunner/instance-runner-import.cfg.in index b28bd4470af649e019b9ba9e8e3c9350c69d6670..5ecb129856957fe3f8d0d4565b4a6678774bd75d 100644 --- a/software/slaprunner/instance-runner-import.cfg.in +++ b/software/slaprunner/instance-runner-import.cfg.in @@ -76,7 +76,8 @@ context = key backend_url slaprunner:access-url key proxy_host slaprunner:ipv4 section directory directory - raw shell_binary ${dash:location}/bin/dash + raw output_log_file $${directory:log}/resilient.log + raw shell_binary ${bash:location}/bin/bash raw rsync_binary ${rsync:location}/bin/rsync raw restore_exit_code_file $${:restore-exit-code-file} diff --git a/software/slaprunner/template/runner-export.sh.jinja2 b/software/slaprunner/template/runner-export.sh.jinja2 index 56dddcff4710c7b1cfdc0af8223475c551382a1b..84ebc80eb3dcb1c020561d1d902e0a485e9d3421 100644 --- a/software/slaprunner/template/runner-export.sh.jinja2 +++ b/software/slaprunner/template/runner-export.sh.jinja2 @@ -6,6 +6,12 @@ umask 077 # Exit on any error, to prevent inconsistent backup set -e +# Redirect output to log +exec > >(tee -ai {{ output_log_file }}) +exec 2>&1 + +echo -e "\n\n$0 run at : $(date)" + srv_directory={{ directory['srv'] }} sync_element () { @@ -38,8 +44,9 @@ sync_element () { echo "Changing current directory to $path." cd $path; if [ -f $element ] || [ -d $element ]; then - echo "Running {{ rsync_binary }} -rlptgov --safe-links --exclude-from=$srv_directory/exporter.exclude --delete --delete-excluded $element $backup_path" - {{ rsync_binary }} -rlptgov --safe-links --exclude-from=$srv_directory/exporter.exclude --delete --delete-excluded $element $backup_path; + command="{{ rsync_binary }} -rlptgov --stats --safe-links --exclude-from=$srv_directory/exporter.exclude --delete --delete-excluded $element $backup_path" + echo "Running : $command" + $command fi done } diff --git a/software/slaprunner/template/runner-import.sh.jinja2 b/software/slaprunner/template/runner-import.sh.jinja2 index 1af1a9a82f11733dd331fce3663692bb8d536ee9..ab14fcab775565f0b00aa05aadab2bb5f1b4aa67 100644 --- a/software/slaprunner/template/runner-import.sh.jinja2 +++ b/software/slaprunner/template/runner-import.sh.jinja2 @@ -3,6 +3,13 @@ set -e LC_ALL=C export LC_ALL umask 077 + +# Redirect output to log +exec > >(tee -ai {{ output_log_file }}) +exec 2>&1 + +echo -e "\n\nrunner-import run at : $(date)" + srv_directory={{ directory['srv'] }} restore_element () { backup_path=$1 @@ -13,7 +20,9 @@ restore_element () { do cd $backup_path; if [ -f $element ] || [ -d $element ]; then - {{ rsync_binary }} -av --delete --exclude *.sock --exclude *.pid --exclude .installed.cfg --exclude .installed-switch-softwaretype.cfg $backup_path/$element $restore_path; + command="{{ rsync_binary }} --stats -av --delete --exclude *.sock --exclude *.pid --exclude .installed.cfg --exclude .installed-switch-softwaretype.cfg $backup_path/$element $restore_path" + echo "Running: \"$command\"" + $command fi done } @@ -62,7 +71,6 @@ $SQLITE3 $DATABASE "update software11 set url='$SOFTWARE_RELEASE' where url='$OL # Change slapproxy database to have all instances stopped $SQLITE3 $DATABASE "update partition11 set slap_state='stopped';" -set -x # Run slapproxy on different port (in case of running inside of erp5testnode # with only one IP and port 50000 already taken by slapproxy of main instance) HOST="{{ proxy_host }}"