101 pg_fatal(
"could not open archive location \"%s\": %m",
165 pg_fatal(
"could not remove file \"%s\": %m",
170 pg_fatal(
"could not read archive location \"%s\": %m",
173 pg_fatal(
"could not close archive location \"%s\": %m",
260 printf(
_(
"%s removes older WAL files from PostgreSQL archives.\n\n"),
progname);
262 printf(
_(
" %s [OPTION]... ARCHIVELOCATION OLDESTKEPTWALFILE\n"),
progname);
264 printf(
_(
" -b, --clean-backup-history clean up files including backup history files\n"));
265 printf(
_(
" -d, --debug generate debug output (verbose mode)\n"));
266 printf(
_(
" -n, --dry-run dry run, show the names of the files that would be\n"
268 printf(
_(
" -V, --version output version information, then exit\n"));
269 printf(
_(
" -x, --strip-extension=EXT strip this extension before identifying files for\n"
271 printf(
_(
" -?, --help show this help, then exit\n"));
273 "For use as \"archive_cleanup_command\" in postgresql.conf:\n"
274 " archive_cleanup_command = 'pg_archivecleanup [OPTION]... ARCHIVELOCATION %%r'\n"
276 " archive_cleanup_command = 'pg_archivecleanup /mnt/server/archiverdir %%r'\n"));
278 "Or for use as a standalone archive cleaner:\n"
280 " pg_archivecleanup /mnt/server/archiverdir 000000010000000000000010.00000020.backup\n"));
304 if (
strcmp(argv[1],
"--help") == 0 ||
strcmp(argv[1],
"-?") == 0)
309 if (
strcmp(argv[1],
"--version") == 0 ||
strcmp(argv[1],
"-V") == 0)
380 "No files will be removed.");
#define PG_TEXTDOMAIN(domain)
void set_pglocale_pgservice(const char *argv0, const char *app)
struct dirent * readdir(DIR *)
DIR * opendir(const char *)
char * pg_strdup(const char *in)
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
#define required_argument
void pg_logging_increase_verbosity(void)
void pg_logging_init(const char *argv0)
#define pg_log_error(...)
#define pg_log_error_hint(...)
#define pg_log_debug(...)
static char * restartWALFileName
static char * archiveLocation
static char * additional_ext
static bool cleanBackupHistory
static char exclusiveCleanupFileName[MAXFNAMELEN]
static void SetWALFileNameForCleanup(void)
static void CleanupPriorWALFiles(void)
static void Initialize(void)
static const char * progname
static void TrimExtension(char *filename, char *extension)
PGDLLIMPORT char * optarg
const char * get_progname(const char *argv0)
size_t strlcpy(char *dst, const char *src, size_t siz)
static bool IsXLogFileName(const char *fname)
static bool IsBackupHistoryFileName(const char *fname)
static void XLogFileNameById(char *fname, TimeLineID tli, uint32 log, uint32 seg)
static bool IsPartialXLogFileName(const char *fname)