@@ -86,6 +86,19 @@ while true; do
8686 esac
8787done
8888
89+ start_cron () {
90+ echo " Starting cron ..."
91+ if $CLUSTER ; then
92+ if ! ghe-ssh " $GHE_HOSTNAME " -- " ghe-cluster-each -- sudo service cron start" ; then
93+ echo " * Warning: Failed to start cron on one or more nodes"
94+ fi
95+ else
96+ if ! ghe-ssh " $GHE_HOSTNAME " -- " sudo service cron start" ; then
97+ echo " * Warning: Failed to start cron"
98+ fi
99+ fi
100+ }
101+
89102cleanup () {
90103 if [ -n " $1 " ]; then
91104 update_restore_status " $1 "
@@ -103,6 +116,10 @@ cleanup () {
103116 fi
104117 fi
105118
119+ if ! $CRON_RUNNING ; then
120+ start_cron
121+ fi
122+
106123 # Cleanup SSH multiplexing
107124 ghe-ssh --clean
108125}
@@ -249,6 +266,7 @@ update_restore_status () {
249266 fi
250267}
251268
269+ CRON_RUNNING=true
252270# Update remote restore state file and setup failure trap
253271trap " cleanup failed" EXIT
254272update_restore_status " restoring"
314332 fi
315333 fi
316334fi
317-
335+ CRON_RUNNING=false
318336
319337# Restore settings and license if restoring to an unconfigured appliance or when
320338# specified manually.
@@ -474,16 +492,8 @@ if ! $RESTORE_SETTINGS; then
474492fi
475493
476494# Start cron. Timerd will start automatically as part of the config run.
477- echo " Starting cron ..."
478- if $CLUSTER ; then
479- if ! ghe-ssh " $GHE_HOSTNAME " -- " ghe-cluster-each -- sudo service cron start" ; then
480- echo " * Warning: Failed to start cron on one or more nodes"
481- fi
482- else
483- if ! ghe-ssh " $GHE_HOSTNAME " -- " sudo service cron start" ; then
484- echo " * Warning: Failed to start cron"
485- fi
486- fi
495+ start_cron
496+ CRON_RUNNING=true
487497
488498# Clean up all stale replicas on configured instances.
489499if ! $CLUSTER && $instance_configured ; then
0 commit comments