]> git.sur5r.net Git - bacula/bacula/commitdiff
Do not update state file after a bacula-xxx -t
authorEric Bollengier <eric@baculasystems.com>
Tue, 15 Sep 2015 07:57:10 +0000 (09:57 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 21 Nov 2015 17:11:15 +0000 (09:11 -0800)
bacula/src/dird/dird.c
bacula/src/filed/filed.c
bacula/src/stored/stored.c

index aa1ec186a8c3225b4346e565fc214e86c5771c4b..3b5401c2c3704f93cce4c39a6099baf268fd1519 100644 (file)
@@ -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) {
index 8e273bfe04cc041f1c724c41e157e7f997794987..de191b53ca7d77c551c44fde727e91666ee92971 100644 (file)
@@ -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);
index 57820883402fee8d1ec54dca07b6ca526c87a612..abf0d4f8820280726f863f7824a2063c94dc8af5 100644 (file)
@@ -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);