@@ -329,47 +329,6 @@ main(int argc, char *argv[])
329
329
}
330
330
canonicalize_path (backup_path );
331
331
332
- /* Ensure that backup_path is an absolute path */
333
- if (!is_absolute_path (backup_path ))
334
- elog (ERROR ,"-B, --backup-path must be an absolute path" );
335
-
336
- /*
337
- * We read options from command line, now we need to read them from
338
- * configuration file since we got backup path and instance name.
339
- * For some commands an instance option isn't required, see above.
340
- */
341
- if (instance_name )
342
- {
343
- char path [MAXPGPATH ];
344
-
345
- /* Read environment variables */
346
- config_get_opt_env (instance_options );
347
-
348
- /* Read options from configuration file */
349
- join_path_components (path ,backup_instance_path ,BACKUP_CATALOG_CONF_FILE );
350
- config_read_opt (path ,instance_options ,ERROR , true);
351
- }
352
-
353
- if (IsSshProtocol ()
354
- && (backup_subcmd == BACKUP_CMD || backup_subcmd == ADD_INSTANCE_CMD || backup_subcmd == RESTORE_CMD ||
355
- backup_subcmd == ARCHIVE_PUSH_CMD || backup_subcmd == ARCHIVE_GET_CMD ))
356
- {
357
- if (remote_agent ) {
358
- if (backup_subcmd != BACKUP_CMD && backup_subcmd != ARCHIVE_PUSH_CMD ) {
359
- fio_communicate (STDIN_FILENO ,STDOUT_FILENO );
360
- return 0 ;
361
- }
362
- fio_redirect (STDIN_FILENO ,STDOUT_FILENO );
363
- }else {
364
- /* Execute remote probackup */
365
- int status = remote_execute (argc ,argv ,backup_subcmd == BACKUP_CMD || backup_subcmd == ARCHIVE_PUSH_CMD );
366
- if (status != 0 || backup_subcmd == ARCHIVE_PUSH_CMD )
367
- {
368
- return status ;
369
- }
370
- }
371
- }
372
-
373
332
if (!remote_agent )
374
333
{
375
334
/* Ensure that backup_path is a path to a directory */
@@ -378,6 +337,11 @@ main(int argc, char *argv[])
378
337
elog (ERROR ,"-B, --backup-path must be a path to directory" );
379
338
}
380
339
340
+ /* Ensure that backup_path is an absolute path */
341
+ if (!is_absolute_path (backup_path ))
342
+ elog (ERROR ,"-B, --backup-path must be an absolute path" );
343
+
344
+
381
345
/* Option --instance is required for all commands except init and show */
382
346
if (backup_subcmd != INIT_CMD && backup_subcmd != SHOW_CMD &&
383
347
backup_subcmd != VALIDATE_CMD )
@@ -409,9 +373,46 @@ main(int argc, char *argv[])
409
373
}
410
374
}
411
375
376
+ /*
377
+ * We read options from command line, now we need to read them from
378
+ * configuration file since we got backup path and instance name.
379
+ * For some commands an instance option isn't required, see above.
380
+ */
381
+ if (instance_name && !remote_agent )
382
+ {
383
+ char path [MAXPGPATH ];
384
+
385
+ /* Read environment variables */
386
+ config_get_opt_env (instance_options );
387
+
388
+ /* Read options from configuration file */
389
+ join_path_components (path ,backup_instance_path ,BACKUP_CATALOG_CONF_FILE );
390
+ config_read_opt (path ,instance_options ,ERROR , true);
391
+ }
392
+
412
393
/* Initialize logger */
413
394
init_logger (backup_path ,& instance_config .logger );
414
395
396
+ if (IsSshProtocol ()
397
+ && (backup_subcmd == BACKUP_CMD || backup_subcmd == ADD_INSTANCE_CMD || backup_subcmd == RESTORE_CMD ||
398
+ backup_subcmd == ARCHIVE_PUSH_CMD || backup_subcmd == ARCHIVE_GET_CMD ))
399
+ {
400
+ if (remote_agent ) {
401
+ if (backup_subcmd != BACKUP_CMD && backup_subcmd != ARCHIVE_PUSH_CMD ) {
402
+ fio_communicate (STDIN_FILENO ,STDOUT_FILENO );
403
+ return 0 ;
404
+ }
405
+ fio_redirect (STDIN_FILENO ,STDOUT_FILENO );
406
+ }else {
407
+ /* Execute remote probackup */
408
+ int status = remote_execute (argc ,argv ,backup_subcmd == BACKUP_CMD || backup_subcmd == ARCHIVE_PUSH_CMD );
409
+ if (status != 0 || backup_subcmd == ARCHIVE_PUSH_CMD )
410
+ {
411
+ return status ;
412
+ }
413
+ }
414
+ }
415
+
415
416
/* command was initialized for a few commands */
416
417
if (command )
417
418
{