]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_dotcmds.c
Fix bug #1367 by creating an empty query.sql file
[bacula/bacula] / bacula / src / dird / ua_dotcmds.c
index c277c64b420a1104216b3ad97f722614c9c1bbf5..ef777e207825e1c9c55ce10e1057e39717774c42 100644 (file)
@@ -68,6 +68,8 @@ static bool getmsgscmd(UAContext *ua, const char *cmd);
 static bool volstatuscmd(UAContext *ua, const char *cmd);
 static bool mediatypescmd(UAContext *ua, const char *cmd);
 static bool locationscmd(UAContext *ua, const char *cmd);
+static bool mediacmd(UAContext *ua, const char *cmd);
+static bool aopcmd(UAContext *ua, const char *cmd);
 
 static bool dot_bvfs_lsdirs(UAContext *ua, const char *cmd);
 static bool dot_bvfs_lsfiles(UAContext *ua, const char *cmd);
@@ -98,8 +100,10 @@ static struct cmdstruct commands[] = { /* help */  /* can be used in runscript *
  { NT_(".status"),     dot_status_cmd,   NULL,       false},
  { NT_(".storage"),    storagecmd,       NULL,       true},
  { NT_(".volstatus"),  volstatuscmd,     NULL,       true},
+ { NT_(".media"),      mediacmd,         NULL,       true},
  { NT_(".mediatypes"), mediatypescmd,    NULL,       true},
  { NT_(".locations"),  locationscmd,     NULL,       true},
+ { NT_(".actiononpurge"),aopcmd,         NULL,       true},
  { NT_(".bvfs_lsdirs"), dot_bvfs_lsdirs, NULL,       true},
  { NT_(".bvfs_lsfiles"),dot_bvfs_lsfiles,NULL,       true},
  { NT_(".bvfs_update"), dot_bvfs_update, NULL,       true},
@@ -583,6 +587,12 @@ static bool storagecmd(UAContext *ua, const char *cmd)
    return true;
 }
 
+static bool aopcmd(UAContext *ua, const char *cmd)
+{
+   ua->send_msg("None\n");
+   ua->send_msg("Truncate\n");
+   return true;
+}
 
 static bool typescmd(UAContext *ua, const char *cmd)
 {
@@ -594,7 +604,6 @@ static bool typescmd(UAContext *ua, const char *cmd)
    return true;
 }
 
-
 /*
  * If this command is called, it tells the director that we
  *  are a program that wants a sort of API, and hence,
@@ -714,6 +723,20 @@ static bool mediatypescmd(UAContext *ua, const char *cmd)
    return true;
 }
 
+static bool mediacmd(UAContext *ua, const char *cmd)
+{
+   if (!open_client_db(ua)) {
+      return true;
+   }
+   if (!db_sql_query(ua->db, 
+                  "SELECT DISTINCT Media.VolumeName FROM Media ORDER BY VolumeName",
+                  one_handler, (void *)ua)) 
+   {
+      ua->error_msg(_("List Media failed: ERR=%s\n"), db_strerror(ua->db));
+   }
+   return true;
+}
+
 static bool locationscmd(UAContext *ua, const char *cmd)
 {
    if (!open_client_db(ua)) {