|
@@ -228,14 +228,21 @@ function backup_local_ghost {
|
228
|
228
|
GHOST_DOMAIN_NAME=$(get_completion_param "ghost domain")
|
229
|
229
|
fi
|
230
|
230
|
|
|
231
|
+ suspend_site ${GHOST_DOMAIN_NAME}
|
|
232
|
+ systemctl stop ghost
|
|
233
|
+
|
231
|
234
|
ghost_path=/var/www/${GHOST_DOMAIN_NAME}/htdocs/content
|
232
|
235
|
if [ -d $ghost_path ]; then
|
233
|
|
- suspend_site ${GHOST_DOMAIN_NAME}
|
234
|
|
- systemctl stop ghost
|
235
|
236
|
backup_directory_to_usb $ghost_path ghostcontent
|
236
|
|
- systemctl start ghost
|
237
|
|
- restart_site
|
238
|
237
|
fi
|
|
238
|
+
|
|
239
|
+ ghost_path=/var/www/${GHOST_DOMAIN_NAME}/htdocs/current/content
|
|
240
|
+ if [ -d $ghost_path ]; then
|
|
241
|
+ backup_directory_to_usb $ghost_path ghostcurrent
|
|
242
|
+ fi
|
|
243
|
+
|
|
244
|
+ systemctl start ghost
|
|
245
|
+ restart_site
|
239
|
246
|
}
|
240
|
247
|
|
241
|
248
|
function restore_local_ghost {
|
|
@@ -263,6 +270,22 @@ function restore_local_ghost {
|
263
|
270
|
rm -rf $temp_restore_dir
|
264
|
271
|
fi
|
265
|
272
|
|
|
273
|
+ temp_restore_dir=/root/tempghostcurrent
|
|
274
|
+ function_check restore_directory_from_usb
|
|
275
|
+ restore_directory_from_usb $temp_restore_dir ghostcurrent
|
|
276
|
+ if [ -d $temp_restore_dir ]; then
|
|
277
|
+ if [ -d $temp_restore_dir/var/www/$GHOST_DOMAIN_NAME/htdocs/current/content ]; then
|
|
278
|
+ cp -r $temp_restore_dir/var/www/$GHOST_DOMAIN_NAME/htdocs/current/content/* /var/www/$GHOST_DOMAIN_NAME/htdocs/current/content/
|
|
279
|
+ else
|
|
280
|
+ if [ ! -d /var/www/$GHOST_DOMAIN_NAME/htdocs/current/content ]; then
|
|
281
|
+ mkdir -p /var/www/$GHOST_DOMAIN_NAME/htdocs/current/content
|
|
282
|
+ fi
|
|
283
|
+ cp -r $temp_restore_dir/* /var/www/$GHOST_DOMAIN_NAME/htdocs/current/content/
|
|
284
|
+ fi
|
|
285
|
+ chown -R ghost:ghost /var/www/$GHOST_DOMAIN_NAME/htdocs/current/content
|
|
286
|
+ rm -rf $temp_restore_dir
|
|
287
|
+ fi
|
|
288
|
+
|
266
|
289
|
systemctl start ghost
|
267
|
290
|
restart_site
|
268
|
291
|
fi
|
|
@@ -274,15 +297,27 @@ function backup_remote_ghost {
|
274
|
297
|
GHOST_DOMAIN_NAME=$(get_completion_param "ghost domain")
|
275
|
298
|
fi
|
276
|
299
|
|
|
300
|
+ suspend_site ${GHOST_DOMAIN_NAME}
|
|
301
|
+
|
277
|
302
|
temp_backup_dir=/var/www/${GHOST_DOMAIN_NAME}/htdocs/content
|
278
|
303
|
if [ -d $temp_backup_dir ]; then
|
279
|
|
- suspend_site ${GHOST_DOMAIN_NAME}
|
280
|
304
|
backup_directory_to_friend $temp_backup_dir ghostcontent
|
281
|
|
- restart_site
|
282
|
305
|
else
|
|
306
|
+ restart_site
|
283
|
307
|
echo $"Ghost domain specified but not found in /var/www/${GHOST_DOMAIN_NAME}"
|
284
|
308
|
exit 2578
|
285
|
309
|
fi
|
|
310
|
+
|
|
311
|
+ temp_backup_dir=/var/www/${GHOST_DOMAIN_NAME}/htdocs/current/content
|
|
312
|
+ if [ -d $temp_backup_dir ]; then
|
|
313
|
+ backup_directory_to_friend $temp_backup_dir ghostcurrent
|
|
314
|
+ else
|
|
315
|
+ restart_site
|
|
316
|
+ echo $"Ghost domain specified but not found in $temp_backup_dir"
|
|
317
|
+ exit 78353
|
|
318
|
+ fi
|
|
319
|
+
|
|
320
|
+ restart_site
|
286
|
321
|
}
|
287
|
322
|
|
288
|
323
|
function restore_remote_ghost {
|
|
@@ -310,6 +345,22 @@ function restore_remote_ghost {
|
310
|
345
|
rm -rf $temp_restore_dir
|
311
|
346
|
fi
|
312
|
347
|
|
|
348
|
+ temp_restore_dir=/root/tempghostcurrent
|
|
349
|
+ function_check restore_directory_from_friend
|
|
350
|
+ restore_directory_from_friend $temp_restore_dir ghostcurrent
|
|
351
|
+ if [ -d $temp_restore_dir ]; then
|
|
352
|
+ if [ -d $temp_restore_dir/var/www/$GHOST_DOMAIN_NAME/htdocs/current/content ]; then
|
|
353
|
+ cp -r $temp_restore_dir/var/www/$GHOST_DOMAIN_NAME/htdocs/current/content/* /var/www/$GHOST_DOMAIN_NAME/htdocs/current/content/
|
|
354
|
+ else
|
|
355
|
+ if [ ! -d /var/www/$GHOST_DOMAIN_NAME/htdocs/current/content ]; then
|
|
356
|
+ mkdir -p /var/www/$GHOST_DOMAIN_NAME/htdocs/current/content
|
|
357
|
+ fi
|
|
358
|
+ cp -r $temp_restore_dir/* /var/www/$GHOST_DOMAIN_NAME/htdocs/current/content/
|
|
359
|
+ fi
|
|
360
|
+ chown -R ghost: /var/www/$GHOST_DOMAIN_NAME/htdocs
|
|
361
|
+ rm -rf $temp_restore_dir
|
|
362
|
+ fi
|
|
363
|
+
|
313
|
364
|
systemctl start ghost
|
314
|
365
|
restart_site
|
315
|
366
|
}
|