From: Eric Bollengier Date: Tue, 15 Sep 2015 07:57:10 +0000 (+0200) Subject: Do not update state file after a bacula-xxx -t X-Git-Tag: Release-7.4.0~198 X-Git-Url: https://git.sur5r.net/?p=bacula%2Fbacula;a=commitdiff_plain;h=61daef1b4ba123728b637d3c94dcd85ed10fa11f Do not update state file after a bacula-xxx -t --- diff --git a/bacula/src/dird/dird.c b/bacula/src/dird/dird.c index aa1ec186a8..3b5401c2c3 100644 --- a/bacula/src/dird/dird.c +++ b/bacula/src/dird/dird.c @@ -68,6 +68,7 @@ static char *runjob = NULL; static bool background = true; static void init_reload(void); static CONFIG *config; +static bool test_config = false; /* Globals Exported */ DIRRES *director; /* Director resource */ @@ -163,7 +164,6 @@ int main (int argc, char *argv[]) int ch; JCR *jcr; bool no_signals = false; - bool test_config = false; char *uid = NULL; char *gid = NULL; @@ -567,8 +567,10 @@ void terminate_dird(int sig) stop_watchdog(); generate_daemon_event(NULL, "Exit"); unload_plugins(); - write_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs)); - delete_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs)); + if (!test_config) { + write_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs)); + delete_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs)); + } term_scheduler(); term_job_server(); if (runjob) { diff --git a/bacula/src/filed/filed.c b/bacula/src/filed/filed.c index 8e273bfe04..de191b53ca 100644 --- a/bacula/src/filed/filed.c +++ b/bacula/src/filed/filed.c @@ -46,6 +46,7 @@ extern struct s_cmds cmds[]; #endif char *configfile = NULL; +static bool test_config = false; static bool foreground = false; static workq_t dir_workq; /* queue of work from Director */ static pthread_t server_tid; @@ -85,7 +86,6 @@ static void usage() int main (int argc, char *argv[]) { int ch; - bool test_config = false; bool keep_readall_caps = false; char *uid = NULL; char *gid = NULL; @@ -279,8 +279,13 @@ void terminate_filed(int sig) bnet_stop_thread_server(server_tid); generate_daemon_event(NULL, "Exit"); unload_plugins(); - write_state_file(me->working_directory, "bacula-fd", get_first_port_host_order(me->FDaddrs)); - delete_pid_file(me->pid_directory, "bacula-fd", get_first_port_host_order(me->FDaddrs)); + + if (!test_config) { + write_state_file(me->working_directory, + "bacula-fd", get_first_port_host_order(me->FDaddrs)); + delete_pid_file(me->pid_directory, + "bacula-fd", get_first_port_host_order(me->FDaddrs)); + } if (configfile != NULL) { free(configfile); diff --git a/bacula/src/stored/stored.c b/bacula/src/stored/stored.c index 5782088340..abf0d4f882 100644 --- a/bacula/src/stored/stored.c +++ b/bacula/src/stored/stored.c @@ -59,6 +59,7 @@ bool forge_on = false; /* proceed inspite of I/O errors */ pthread_mutex_t device_release_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t wait_device_release = PTHREAD_COND_INITIALIZER; void *start_heap; +static bool test_config = false; static uint32_t VolSessionId = 0; @@ -111,7 +112,6 @@ int main (int argc, char *argv[]) { int ch; bool no_signals = false; - bool test_config = false; pthread_t thid; char *uid = NULL; char *gid = NULL; @@ -691,8 +691,12 @@ void terminate_stored(int sig) bmicrosleep(0, 500000); /* give them 1/2 sec to clean up */ } - write_state_file(me->working_directory, "bacula-sd", get_first_port_host_order(me->sdaddrs)); - delete_pid_file(me->pid_directory, "bacula-sd", get_first_port_host_order(me->sdaddrs)); + if (!test_config) { + write_state_file(me->working_directory, + "bacula-sd", get_first_port_host_order(me->sdaddrs)); + delete_pid_file(me->pid_directory, + "bacula-sd", get_first_port_host_order(me->sdaddrs)); + } Dmsg1(200, "In terminate_stored() sig=%d\n", sig);