projects
/
debian
/
amanda
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lintian doesn't like orphan packages with uploaders...
[debian/amanda]
/
server-src
/
amcheck.c
diff --git
a/server-src/amcheck.c
b/server-src/amcheck.c
index 2c843a9b46b0955efc8e9ebe28c328ec965d1c04..87f2d4ad2be485663666383c0f33a2eb1507fac2 100644
(file)
--- a/
server-src/amcheck.c
+++ b/
server-src/amcheck.c
@@
-1,6
+1,7
@@
/*
* Amanda, The Advanced Maryland Automatic Network Disk Archiver
* Copyright (c) 1991-2000 University of Maryland at College Park
/*
* Amanda, The Advanced Maryland Automatic Network Disk Archiver
* Copyright (c) 1991-2000 University of Maryland at College Park
+ * Copyright (c) 2007-2012 Zmanda, Inc. All Rights Reserved.
* All Rights Reserved.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* All Rights Reserved.
*
* Permission to use, copy, modify, distribute, and sell this software and its
@@
-48,6
+49,7
@@
#include "timestamp.h"
#include "amxml.h"
#include "physmem.h"
#include "timestamp.h"
#include "amxml.h"
#include "physmem.h"
+#include <getopt.h>
#define BUFFER_SIZE 32768
#define BUFFER_SIZE 32768
@@
-70,7
+72,7
@@
int test_server_pgm(FILE *outf, char *dir, char *pgm, int suid, uid_t dumpuid);
void
usage(void)
{
void
usage(void)
{
- g_printf(_("Usage: amcheck [-
am] [-w] [-sclt] [-M <address>
] [-o configoption]* <conf> [host [disk]* ]*\n"));
+ g_printf(_("Usage: amcheck [-
-version] [-am] [-w] [-sclt] [-M <address>] [--client-verbose] [--exact_match
] [-o configoption]* <conf> [host [disk]* ]*\n"));
exit(1);
/*NOTREACHED*/
}
exit(1);
/*NOTREACHED*/
}
@@
-80,6
+82,15
@@
static char *our_feature_string = NULL;
static char *displayunit;
static long int unitdivisor;
static char *displayunit;
static long int unitdivisor;
+static int client_verbose = FALSE;
+static gboolean exact_match = FALSE;
+static struct option long_options[] = {
+ {"client-verbose", 0, NULL, 1},
+ {"version" , 0, NULL, 2},
+ {"exact-match" , 0, NULL, 3},
+ {NULL, 0, NULL, 0}
+};
+
int
main(
int argc,
int
main(
int argc,
@@
-92,7
+103,7
@@
main(
int do_clientchk, client_probs;
int do_localchk, do_tapechk, server_probs;
pid_t clientchk_pid, serverchk_pid;
int do_clientchk, client_probs;
int do_localchk, do_tapechk, server_probs;
pid_t clientchk_pid, serverchk_pid;
- int
opt,
tempfd, mainfd;
+ int tempfd, mainfd;
size_t size;
amwait_t retstat;
pid_t pid;
size_t size;
amwait_t retstat;
pid_t pid;
@@
-152,8
+163,22
@@
main(
/* process arguments */
cfg_ovr = new_config_overrides(argc/2);
/* process arguments */
cfg_ovr = new_config_overrides(argc/2);
- while((opt = getopt(argc, argv, "M:mawsclto:")) != EOF) {
- switch(opt) {
+ while (1) {
+ int option_index = 0;
+ int c;
+ c = getopt_long (argc, argv, "M:mawsclto:", long_options, &option_index);
+ if (c == -1) {
+ break;
+ }
+
+ switch(c) {
+ case 1: client_verbose = TRUE;
+ break;
+ case 2: printf("amcheck-%s\n", VERSION);
+ return(0);
+ break;
+ case 3: exact_match = TRUE;
+ break;
case 'M': if (mailto) {
g_printf(_("Multiple -M options\n"));
exit(1);
case 'M': if (mailto) {
g_printf(_("Multiple -M options\n"));
exit(1);
@@
-258,7
+283,7
@@
main(
conf_ctimeout = (time_t)getconf_int(CNF_CTIMEOUT);
conf_ctimeout = (time_t)getconf_int(CNF_CTIMEOUT);
- errstr = match_disklist(&origq, argc-1, argv+1);
+ errstr = match_disklist(&origq,
exact_match,
argc-1, argv+1);
if (errstr) {
g_printf(_("%s"),errstr);
amfree(errstr);
if (errstr) {
g_printf(_("%s"),errstr);
amfree(errstr);
@@
-748,8
+773,8
@@
start_server_check(
}
if (getconf_int(CNF_TAPERFLUSH) > 0 &&
}
if (getconf_int(CNF_TAPERFLUSH) > 0 &&
- !getconf_
boolean
(CNF_AUTOFLUSH)) {
- g_fprintf(outf, _("WARNING: autoflush must be set to 'yes' if taperflush (%d) is greater that 0.\n"),
+ !getconf_
no_yes_all
(CNF_AUTOFLUSH)) {
+ g_fprintf(outf, _("WARNING: autoflush must be set to 'yes'
or 'all'
if taperflush (%d) is greater that 0.\n"),
getconf_int(CNF_TAPERFLUSH));
}
getconf_int(CNF_TAPERFLUSH));
}
@@
-1928,6
+1953,13
@@
start_host(
g_fprintf(outf,
_("ERROR: application '%s' not found.\n"), dp->application);
} else {
g_fprintf(outf,
_("ERROR: application '%s' not found.\n"), dp->application);
} else {
+ char *client_name = application_get_client_name(application);
+ if (client_name && strlen(client_name) > 0 &&
+ !am_has_feature(hostp->features, fe_application_client_name)) {
+ g_fprintf(outf,
+ _("WARNING: %s:%s does not support client-name in application.\n"),
+ hostp->hostname, qname);
+ }
xml_app = xml_application(dp, application, hostp->features);
vstrextend(&l, xml_app, NULL);
amfree(xml_app);
xml_app = xml_application(dp, application, hostp->features);
vstrextend(&l, xml_app, NULL);
amfree(xml_app);
@@
-1938,6
+1970,19
@@
start_host(
g_fprintf(outf,
_("ERROR: %s:%s does not support SCRIPT-API.\n"),
hostp->hostname, qname);
g_fprintf(outf,
_("ERROR: %s:%s does not support SCRIPT-API.\n"),
hostp->hostname, qname);
+ } else {
+ identlist_t pp_scriptlist;
+ for (pp_scriptlist = dp->pp_scriptlist; pp_scriptlist != NULL;
+ pp_scriptlist = pp_scriptlist->next) {
+ pp_script_t *pp_script = lookup_pp_script((char *)pp_scriptlist->data);
+ char *client_name = pp_script_get_client_name(pp_script);;
+ if (client_name && strlen(client_name) > 0 &&
+ !am_has_feature(hostp->features, fe_script_client_name)) {
+ g_fprintf(outf,
+ _("WARNING: %s:%s does not support client-name in script.\n"),
+ hostp->hostname, dp->name);
+ }
+ }
}
}
es = xml_estimate(dp->estimatelist, hostp->features);
}
}
es = xml_estimate(dp->estimatelist, hostp->features);
@@
-2035,6
+2080,7
@@
start_client_checks(
g_fprintf(outf, _("\nAmanda Backup Client Hosts Check\n"));
g_fprintf(outf, "--------------------------------\n");
g_fprintf(outf, _("\nAmanda Backup Client Hosts Check\n"));
g_fprintf(outf, "--------------------------------\n");
+ run_server_global_scripts(EXECUTE_ON_PRE_AMCHECK, get_config_name());
protocol_init();
hostcount = remote_errors = 0;
protocol_init();
hostcount = remote_errors = 0;
@@
-2042,12
+2088,10
@@
start_client_checks(
for(dp = origq.head; dp != NULL; dp = dp->next) {
hostp = dp->host;
if(hostp->up == HOST_READY && dp->todo == 1) {
for(dp = origq.head; dp != NULL; dp = dp->next) {
hostp = dp->host;
if(hostp->up == HOST_READY && dp->todo == 1) {
+ run_server_host_scripts(EXECUTE_ON_PRE_HOST_AMCHECK,
+ get_config_name(), hostp);
for(dp1 = hostp->disks; dp1 != NULL; dp1 = dp1->hostnext) {
for(dp1 = hostp->disks; dp1 != NULL; dp1 = dp1->hostnext) {
- run_server_scripts(EXECUTE_ON_PRE_HOST_AMCHECK,
- get_config_name(), dp1, -1);
- }
- for(dp1 = hostp->disks; dp1 != NULL; dp1 = dp1->hostnext) {
- run_server_scripts(EXECUTE_ON_PRE_DLE_AMCHECK,
+ run_server_dle_scripts(EXECUTE_ON_PRE_DLE_AMCHECK,
get_config_name(), dp1, -1);
}
start_host(hostp);
get_config_name(), dp1, -1);
}
start_host(hostp);
@@
-2057,6
+2101,7
@@
start_client_checks(
}
protocol_run();
}
protocol_run();
+ run_server_global_scripts(EXECUTE_ON_POST_AMCHECK, get_config_name());
g_fprintf(outf, plural(_("Client check: %d host checked in %s seconds."),
_("Client check: %d hosts checked in %s seconds."),
g_fprintf(outf, plural(_("Client check: %d host checked in %s seconds."),
_("Client check: %d hosts checked in %s seconds."),
@@
-2085,6
+2130,7
@@
handle_result(
char *t;
int ch;
int tch;
char *t;
int ch;
int tch;
+ gboolean printed_hostname = FALSE;
hostp = (am_host_t *)datap;
hostp->up = HOST_READY;
hostp = (am_host_t *)datap;
hostp->up = HOST_READY;
@@
-2135,7
+2181,15
@@
handle_result(
continue;
}
continue;
}
+ if (client_verbose && !printed_hostname) {
+ g_fprintf(outf, "HOST %s\n", hostp->hostname);
+ printed_hostname = TRUE;
+ }
+
if(strncmp_const(line, "OK ") == 0) {
if(strncmp_const(line, "OK ") == 0) {
+ if (client_verbose) {
+ g_fprintf(outf, "%s\n", line);
+ }
continue;
}
continue;
}
@@
-2182,13
+2236,11
@@
handle_result(
if(hostp->up == HOST_DONE) {
security_close_connection(sech, hostp->hostname);
for(dp = hostp->disks; dp != NULL; dp = dp->hostnext) {
if(hostp->up == HOST_DONE) {
security_close_connection(sech, hostp->hostname);
for(dp = hostp->disks; dp != NULL; dp = dp->hostnext) {
- run_server_scripts(EXECUTE_ON_POST_DLE_AMCHECK,
- get_config_name(), dp, -1);
- }
- for(dp = hostp->disks; dp != NULL; dp = dp->hostnext) {
- run_server_scripts(EXECUTE_ON_POST_HOST_AMCHECK,
+ run_server_dle_scripts(EXECUTE_ON_POST_DLE_AMCHECK,
get_config_name(), dp, -1);
}
get_config_name(), dp, -1);
}
+ run_server_host_scripts(EXECUTE_ON_POST_HOST_AMCHECK,
+ get_config_name(), hostp);
}
/* try to clean up any defunct processes, since Amanda doesn't wait() for
them explicitly */
}
/* try to clean up any defunct processes, since Amanda doesn't wait() for
them explicitly */