|
200 | 200 | ghe-backup-store-version ||
|
201 | 201 | echo "Warning: storing backup-utils version remotely failed."
|
202 | 202 |
|
| 203 | +# Stop cron and timerd, as scheduled jobs may disrupt the restore process. |
| 204 | +if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then |
| 205 | + echo "Stopping cron and github-timerd ..." |
| 206 | + if $cluster; then |
| 207 | + if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron stop"; then |
| 208 | + ghe_verbose "* Warning: Failed to stop cron on one or more nodes" |
| 209 | + fi |
| 210 | + |
| 211 | + if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service github-timerd stop"; then |
| 212 | + ghe_verbose "* Warning: Failed to stop github-timerd on one or more nodes" |
| 213 | + fi |
| 214 | + else |
| 215 | + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron stop"; then |
| 216 | + ghe_verbose "* Warning: Failed to stop cron" |
| 217 | + fi |
| 218 | + |
| 219 | + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service github-timerd stop"; then |
| 220 | + ghe_verbose "* Warning: Failed to stop github-timerd" |
| 221 | + fi |
| 222 | + fi |
| 223 | +fi |
| 224 | + |
203 | 225 | # Restore settings and license if restoring to an unconfigured appliance or when
|
204 | 226 | # specified manually.
|
205 | 227 | if $restore_settings; then
|
@@ -323,6 +345,20 @@ elif $instance_configured; then
|
323 | 345 | fi
|
324 | 346 | fi
|
325 | 347 |
|
| 348 | +# Start cron. Timerd will start automatically as part of the config run. |
| 349 | +if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then |
| 350 | + echo "Starting cron ..." |
| 351 | + if $cluster; then |
| 352 | + if ! ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start"; then |
| 353 | + echo "* Warning: Failed to start cron on one or more nodes" |
| 354 | + fi |
| 355 | + else |
| 356 | + if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start"; then |
| 357 | + echo "* Warning: Failed to start cron" |
| 358 | + fi |
| 359 | + fi |
| 360 | +fi |
| 361 | + |
326 | 362 | # Update the remote status to "complete". This has to happen before importing
|
327 | 363 | # ssh host keys because subsequent commands will fail due to the host key
|
328 | 364 | # changing otherwise.
|
|
0 commit comments