/* Options and defaults */ staticbool dryrun = false; /* are we performing a dry-run operation? */ staticbool cleanBackupHistory = false; /* remove files including backup
* history files */ staticchar *additional_ext = NULL; /* Extension to remove from filenames */
staticchar *archiveLocation; /* where to find the archive? */ staticchar *restartWALFileName; /* the file from which we can restart
* restore */ staticchar exclusiveCleanupFileName[MAXFNAMELEN]; /* the oldest file we want
* to remain in archive */
rc = unlink(WALFilePath); if (rc != 0)
pg_fatal("could not remove file \"%s\": %m",
WALFilePath);
}
if (errno)
pg_fatal("could not read archive location \"%s\": %m",
archiveLocation); if (closedir(xldir))
pg_fatal("could not close archive location \"%s\": %m",
archiveLocation);
}
staticvoid
usage(void)
{
printf(_("%s removes older WAL files from PostgreSQL archives.\n\n"), progname);
printf(_("Usage:\n"));
printf(_(" %s [OPTION]... ARCHIVELOCATION OLDESTKEPTWALFILE\n"), progname);
printf(_("\nOptions:\n"));
printf(_(" -b, --clean-backup-history clean up files including backup history files\n"));
printf(_(" -d, --debug generate debug output (verbose mode)\n"));
printf(_(" -n, --dry-run dry run, show the names of the files that would be\n" " removed\n"));
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -x, --strip-extension=EXT strip this extension before identifying files for\n" " clean up\n"));
printf(_(" -?, --help show this help, then exit\n"));
printf(_("\n" "For use as \"archive_cleanup_command\" in postgresql.conf:\n" " archive_cleanup_command = 'pg_archivecleanup [OPTION]... ARCHIVELOCATION %%r'\n" "e.g.\n" " archive_cleanup_command = 'pg_archivecleanup /mnt/server/archiverdir %%r'\n"));
printf(_("\n" "Or for use as a standalone archive cleaner:\n" "e.g.\n" " pg_archivecleanup /mnt/server/archiverdir 000000010000000000000010.00000020.backup\n"));
printf(_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
printf(_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
}
if (optind < argc)
{
restartWALFileName = argv[optind];
optind++;
} else
{
pg_log_error("must specify oldest kept WAL file");
pg_log_error_hint("Try \"%s --help\" for more information.", progname); exit(2);
}
if (optind < argc)
{
pg_log_error("too many command-line arguments");
pg_log_error_hint("Try \"%s --help\" for more information.", progname); exit(2);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.