@@ -123,7 +123,7 @@ cleanup () {
123
123
# Cleanup SSH multiplexing
124
124
ghe-ssh --clean
125
125
# Remove in-progress file
126
- rm -f ${GHE_DATA_DIR} /. in-progress-restore
126
+ rm -f ${GHE_DATA_DIR} /in-progress-restore
127
127
}
128
128
129
129
# This function's type definition is being passed to a remote host via `ghe-ssh` but is not used locally.
@@ -155,26 +155,6 @@ cleanup_cluster_nodes() {
155
155
ghe_parallel_check
156
156
157
157
# ghe_restore_check
158
- if [ -h ${GHE_DATA_DIR} /.in-progress-restore ]; then
159
- echo " Error: detected a restore already in progress from a previous version of ghe-restore." 1>&2
160
- echo " If there is no restore in progress anymore, please remove" 1>&2
161
- echo " the $GHE_DATA_DIR /in-progress-restore file." 1>&2
162
- exit 1
163
- fi
164
-
165
- echo " ${GHE_DATA_DIR} /.in-progress-restore"
166
- if [ -f ${GHE_DATA_DIR} /.in-progress-restore ]; then
167
- progress=$( cat ${GHE_DATA_DIR} /.in-progress-restore)
168
- snapshot=$( echo " $progress " | cut -d ' ' -f 1)
169
- pid=$( echo " $progress " | cut -d ' ' -f 2)
170
- echo " Error: A restore of $GHE_HOSTNAME may still be running on PID $pid ." 1>&2
171
- echo " If PID $pid is not a process related to the restore utilities, please remove" 1>&2
172
- echo " the $GHE_DATA_DIR /in-progress-restore file and try again." 1>&2
173
- exit 1
174
- fi
175
-
176
- # Check to make sure a restore or backup is not in progress
177
-
178
158
179
159
# Grab the host arg
180
160
GHE_HOSTNAME=" ${GHE_RESTORE_HOST_OPT:- $GHE_RESTORE_HOST } "
@@ -194,23 +174,7 @@ GHE_RESTORE_SNAPSHOT_PATH="$(ghe-restore-snapshot-path "$snapshot_id")"
194
174
GHE_RESTORE_SNAPSHOT=$( basename " $GHE_RESTORE_SNAPSHOT_PATH " )
195
175
export GHE_RESTORE_SNAPSHOT
196
176
197
- # ghe_backup_check
198
- if [ -h ${GHE_DATA_DIR} /.in-progress ]; then
199
- echo " Error: detected a backup already in progress from a previous version of ghe-backup." 1>&2
200
- echo " If there is no backup in progress anymore, please remove" 1>&2
201
- echo " the $GHE_DATA_DIR /.in-progress-backup file." 1>&2
202
- exit 1
203
- fi
204
-
205
- if [ -f ${GHE_DATA_DIR} /.in-progress ]; then
206
- progress=$( cat ${GHE_DATA_DIR} /.in-progress)
207
- snapshot=$( echo " $progress " | cut -d ' ' -f 1)
208
- pid=$( echo " $progress " | cut -d ' ' -f 2)
209
- echo " Error: A backup of $GHE_HOSTNAME may still be running on PID $pid ." 1>&2
210
- echo " If PID $pid is not a process related to the backup utilities, please remove" 1>&2
211
- echo " the $GHE_DATA_DIR /.in-progress file and try again." 1>&2
212
- exit 1
213
- fi
177
+ ghe_backup_check
214
178
215
179
# Detect if the backup we are restoring has a leaked ssh key
216
180
echo " Checking for leaked keys in the backup snapshot that is being restored ..."
@@ -295,12 +259,8 @@ echo 'Start time:' $START_TIME
295
259
echo " Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT "
296
260
ghe_remote_logger " Starting restore from $( hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..."
297
261
# Create an in-progress-restore file to prevent simultaneous backup or restore runs
298
- echo " ${START_TIME} $$ " > ${GHE_DATA_DIR} /. in-progress-restore
262
+ echo " ${START_TIME} $$ " > ${GHE_DATA_DIR} /in-progress-restore
299
263
300
- sleep 120
301
- rm -f ${GHE_DATA_DIR} /.in-progress-restore
302
- echo " finished with fake restore"
303
- exit 1
304
264
# Keep other processes on the VM or cluster in the loop about the restore status.
305
265
#
306
266
# Other processes will look for these states:
@@ -627,7 +587,7 @@ echo 'End time:' $END_TIME
627
587
echo ' Runtime:' $(( $END_TIME - $START_TIME )) ' seconds'
628
588
629
589
echo " Restore of $GHE_HOSTNAME from snapshot $GHE_RESTORE_SNAPSHOT finished."
630
- rm -f ${GHE_DATA_DIR} /. in-progress-restore
590
+ rm -f ${GHE_DATA_DIR} /in-progress-restore
631
591
632
592
if ! $instance_configured ; then
633
593
echo " To complete the restore process, please visit https://$hostname /setup/settings to review and save the appliance configuration."
0 commit comments