From cc86fc8f82ec78c1da45473ef298bbddc075f459 Mon Sep 17 00:00:00 2001 From: Steven Honson Date: Wed, 9 Nov 2016 17:37:27 +1100 Subject: [PATCH 1/2] Stop cron and timerd during restore --- bin/ghe-restore | 20 ++++++++++++++++++++ test/bin/service | 3 +++ 2 files changed, 23 insertions(+) create mode 100644 test/bin/service diff --git a/bin/ghe-restore b/bin/ghe-restore index 9bd19f76c..6310857df 100755 --- a/bin/ghe-restore +++ b/bin/ghe-restore @@ -200,6 +200,17 @@ fi ghe-backup-store-version || echo "Warning: storing backup-utils version remotely failed." +# Stop cron and timerd, as scheduled jobs may disrupt the restore process. +if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then + if $cluster; then + ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron stop" + ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service github-timerd stop" + else + ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron stop" + ghe-ssh "$GHE_HOSTNAME" -- "sudo service github-timerd stop" + fi +fi + # Restore settings and license if restoring to an unconfigured appliance or when # specified manually. if $restore_settings; then @@ -323,6 +334,15 @@ elif $instance_configured; then fi fi +# Start cron. Timerd will start automatically as part of the config run. +if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then + if $cluster; then + ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start" + else + ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start" + fi +fi + # Update the remote status to "complete". This has to happen before importing # ssh host keys because subsequent commands will fail due to the host key # changing otherwise. diff --git a/test/bin/service b/test/bin/service new file mode 100644 index 000000000..12c98b95f --- /dev/null +++ b/test/bin/service @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +# Fake service command for tests. +true From b0062815f32eec93d31a3c606b65422d0ab86ff3 Mon Sep 17 00:00:00 2001 From: Steven Honson Date: Wed, 9 Nov 2016 18:55:45 +1100 Subject: [PATCH 2/2] Set +x on fake service command --- test/bin/service | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 test/bin/service diff --git a/test/bin/service b/test/bin/service old mode 100644 new mode 100755