Skip to content

Commit e1363db

Browse files
committed
Ignore errors when stopping and starting services (#75)
1 parent bff2a54 commit e1363db

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

bin/ghe-restore

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,23 @@ echo "Warning: storing backup-utils version remotely failed."
202202

203203
# Stop cron and timerd, as scheduled jobs may disrupt the restore process.
204204
if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
205+
echo "Stopping cron and github-timerd ..."
205206
if $cluster; then
206-
ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron stop"
207-
ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service github-timerd stop"
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
208214
else
209-
ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron stop"
210-
ghe-ssh "$GHE_HOSTNAME" -- "sudo service github-timerd stop"
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
211222
fi
212223
fi
213224

@@ -336,10 +347,15 @@ fi
336347

337348
# Start cron. Timerd will start automatically as part of the config run.
338349
if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
350+
echo "Starting cron ..."
339351
if $cluster; then
340-
ghe-ssh "$GHE_HOSTNAME" -- "ghe-cluster-each -- sudo service cron start"
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
341355
else
342-
ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start"
356+
if ! ghe-ssh "$GHE_HOSTNAME" -- "sudo service cron start"; then
357+
echo "* Warning: Failed to start cron"
358+
fi
343359
fi
344360
fi
345361

0 commit comments

Comments
 (0)