]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_run.c
- Move test for MaxStartDelay as suggested by Peter.
[bacula/bacula] / bacula / src / dird / ua_run.c
index f757f8ba775b342c3dec736c7fef41433b28fc0e..8b02aeaf4804aa5d7278dcd17f76bfeb6721413d 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 /*
-   Copyright (C) 2001-20054 Kern Sibbald
+   Copyright (C) 2001-2005 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -53,6 +53,8 @@ int run_cmd(UAContext *ua, const char *cmd)
    char *where, *fileset_name, *client_name, *bootstrap;
    const char *replace;
    char *when, *verify_job_name, *catalog_name;
+   char *since = NULL;
+   bool cloned = false;
    int Priority = 0;
    int i, j, opt, files = 0;
    bool kw_ok;
@@ -63,24 +65,26 @@ int run_cmd(UAContext *ua, const char *cmd)
    FILESET *fileset = NULL;
    POOL *pool = NULL;
    static const char *kw[] = {       /* command line arguments */
-      N_("job"),                      /*  Used in a switch() */
-      N_("jobid"),                    /* 1 */
-      N_("client"),                   /* 2 */
-      N_("fd"),
-      N_("fileset"),                  /* 4 */
-      N_("level"),                    /* 5 */
-      N_("storage"),                  /* 6 */
-      N_("sd"),                       /* 7 */
-      N_("pool"),                     /* 8 */
-      N_("where"),                    /* 9 */
-      N_("bootstrap"),                /* 10 */
-      N_("replace"),                  /* 11 */
-      N_("when"),                     /* 12 */
-      N_("priority"),                 /* 13 */
-      N_("yes"),          /* 14 -- if you change this change YES_POS too */
-      N_("verifyjob"),                /* 15 */
-      N_("files"),                    /* 16 number of files to restore */
-       N_("catalog"),                 /* 17 override catalog */
+      "job",                          /*  Used in a switch() */
+      "jobid",                        /* 1 */
+      "client",                       /* 2 */
+      "fd",
+      "fileset",                      /* 4 */
+      "level",                        /* 5 */
+      "storage",                      /* 6 */
+      "sd",                           /* 7 */
+      "pool",                         /* 8 */
+      "where",                        /* 9 */
+      "bootstrap",                    /* 10 */
+      "replace",                      /* 11 */
+      "when",                         /* 12 */
+      "priority",                     /* 13 */
+      "yes",          /* 14  -- if you change this change YES_POS too */
+      "verifyjob",                    /* 15 */
+      "files",                        /* 16 number of files to restore */
+      "catalog",                      /* 17 override catalog */
+      "since",                        /* 18 since */
+      "cloned",                       /* 19 cloned */
       NULL};
 
 #define YES_POS 14
@@ -114,7 +118,7 @@ int run_cmd(UAContext *ua, const char *cmd)
                bsendmsg(ua, _("Value missing for keyword %s\n"), ua->argk[i]);
               return 1;
            }
-            Dmsg1(800, "Got keyword=%s\n", kw[j]);
+            Dmsg1(800, "Got keyword=%s\n", NPRT(kw[j]));
            switch (j) {
            case 0: /* job */
               if (job_name) {
@@ -239,6 +243,16 @@ int run_cmd(UAContext *ua, const char *cmd)
               kw_ok = true;
               break;
 
+           case 18: /* since */
+              since = ua->argv[i];
+              kw_ok = true; 
+              break;
+
+           case 19: /* cloned */
+              cloned = true;
+              kw_ok = true;
+              break;
+
            default:
               break;
            }
@@ -273,7 +287,7 @@ int run_cmd(UAContext *ua, const char *cmd)
           return 0;
        }
    }
-   Dmsg1(800, "Using catalog=%s\n", catalog_name);
+   Dmsg1(800, "Using catalog=%s\n", NPRT(catalog_name));
 
    if (job_name) {
       /* Find Job */
@@ -444,6 +458,15 @@ int run_cmd(UAContext *ua, const char *cmd)
       jcr->JobPriority = Priority;
    }
 
+   if (since) {
+      if (!jcr->stime) {
+        jcr->stime = get_pool_memory(PM_MESSAGE);
+      }
+      pm_strcpy(jcr->stime, since);
+   }
+
+   jcr->cloned = cloned;
+
    if (find_arg(ua, _("fdcalled")) > 0) {
       jcr->file_bsock = dup_bsock(ua->UA_sock);
       ua->quit = true;
@@ -617,10 +640,7 @@ try_again:
    /*
     * At user request modify parameters of job to be run.
     */
-   if (ua->cmd[0] == 0) {
-      goto bail_out;
-   }
-   if (strncasecmp(ua->cmd, _("mod"), strlen(ua->cmd)) == 0) {
+   if (ua->cmd[0] != 0 && strncasecmp(ua->cmd, _("mod"), strlen(ua->cmd)) == 0) {
       FILE *fd;
 
       start_prompt(ua, _("Parameters to modify:\n"));
@@ -843,7 +863,7 @@ try_again:
       goto bail_out;
    }
 
-   if (strncasecmp(ua->cmd, _("yes"), strlen(ua->cmd)) == 0) {
+   if (ua->cmd[0] == 0 || strncasecmp(ua->cmd, _("yes"), strlen(ua->cmd)) == 0) {
       JobId_t JobId;
       Dmsg1(800, "Calling run_job job=%x\n", jcr->job);
 start_job: