]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/stored.c
btape test and fill improvements + first cut Qmsg
[bacula/bacula] / bacula / src / stored / stored.c
index 96ba176f9707a6f276968a3222859480b8a70f96..3559143b8867f5a1a0e1d49118e9cdfc9fc28cd4 100644 (file)
@@ -10,7 +10,7 @@
  * 
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -94,7 +94,6 @@ int main (int argc, char *argv[])
    textdomain("bacula-sd");
    init_msg(NULL, NULL);
    daemon_start_time = time(NULL);
-   memset(&last_job, 0, sizeof(last_job));
 
    /* Sanity checks */
    if (TAPE_BSIZE % DEV_BSIZE != 0 || TAPE_BSIZE / DEV_BSIZE == 0) {
@@ -186,10 +185,10 @@ int main (int argc, char *argv[])
       init_stack_dump();             /* pick up new pid */
    }
 
-   drop(uid, gid);
-
    create_pid_file(me->pid_directory, "bacula-sd", me->SDport);
 
+   drop(uid, gid);
+
    /* Ensure that Volume Session Time and Id are both
     * set and are both non-zero.
     */
@@ -210,6 +209,8 @@ int main (int argc, char *argv[])
 
    start_watchdog();                 /* start watchdog thread */
 
+   init_jcr_subsystem();             /* start JCR watchdogs etc. */
+
    /* 
     * Sleep a bit to give device thread a chance to lock the resource
     * chain before we start the server.
@@ -303,8 +304,8 @@ static void *device_allocation(void *arg)
         continue;
       }
       if (device->cap_bits & CAP_ALWAYSOPEN) {
-         Dmsg1(20, "calling open_device %s\n", device->device_name);
-        if (!open_device(device->dev)) {
+         Dmsg1(20, "calling first_open_device %s\n", device->device_name);
+        if (!first_open_device(device->dev)) {
             Emsg1(M_ERROR, 0, _("Could not open device %s\n"), device->device_name);
         }
       }
@@ -373,7 +374,6 @@ void terminate_stored(int sig)
    }
 
    delete_pid_file(me->pid_directory, "bacula-sd", me->SDport);
-   stop_watchdog();
 
    Dmsg1(200, "In terminate_stored() sig=%d\n", sig);
 
@@ -393,6 +393,7 @@ void terminate_stored(int sig)
       print_memory_pool_stats();
    }
    term_msg();
+   stop_watchdog();
    close_memory_pool();
 
    sm_dump(False);                   /* dump orphaned buffers */