Skip to content

Stop cron and timerd during restore #266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions bin/ghe-restore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions test/bin/service
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
# Fake service command for tests.
true