src/dird/snapshot.c
int snapshot_cmd(UAContext *ua, const char *cmd)
{
   SNAPSHOT_DBR snapdbr;
   for (int i=0; i<ua->argc; i++) {
      if (strcasecmp(ua->argk[i], NT_("purge")) == 0) {

      } else if (strcasecmp(ua->argk[i], NT_("prune")) == 0) {
         return prune_snapshot(ua);

      } else if (strcasecmp(ua->argk[i], NT_("listclient")) == 0) {
         return list_client_snapshot(ua, false);

      } else if (strcasecmp(ua->argk[i], NT_("list")) == 0) {
         snapshot_list(ua, 0, prtit, HORZ_LIST);
         return 1;

      } else if (strcasecmp(ua->argk[i], NT_("create")) == 0) {
         /* We need a job definition, or a client */

      } else if (strcasecmp(ua->argk[i], NT_("delete")) == 0) {
         return delete_snapshot(ua);

      } else if (strcasecmp(ua->argk[i], NT_("status")) == 0) {

      } else if (strcasecmp(ua->argk[i], NT_("sync")) == 0) {
         return list_client_snapshot(ua, true);

      } else if (strcasecmp(ua->argk[i], NT_("update")) == 0) {
         return update_snapshot(ua);

      } else {
         continue;
      }
   }

   for ( ;; ) {

      start_prompt(ua, _("Snapshot choice: \n"));
      add_prompt(ua, _("List snapshots in Catalog"));
      add_prompt(ua, _("List snapshots on Client"));
      add_prompt(ua, _("Prune snapshots"));
      add_prompt(ua, _("Delete snapshot"));
      add_prompt(ua, _("Update snapshot parameters"));
      add_prompt(ua, _("Update catalog with Client snapshots"));
      add_prompt(ua, _("Done"));

      switch(do_prompt(ua, "", _("Select action to perform on Snapshot Engine"), NULL, 0)) {
      case 0:                         /* list catalog */
         snapshot_list(ua, 0, prtit, HORZ_LIST);
         break;
      case 1:                         /* list client */
         list_client_snapshot(ua, false);
         break;
      case 2:                   /* prune */
         prune_snapshot(ua);
         break;
      case 3:                   /* delete */
         delete_snapshot(ua);
         break;
      case 4:                      /* update snapshot */
         update_snapshot(ua);
         break;
      case 5:                      /* sync snapshot */
         list_client_snapshot(ua, true);
         break;
      case 6:                   /* done */
      default:
         ua->info_msg(_("Selection terminated.\n"));
         return 1;
      }
   }
   return 1;
}
/* Ask client to create/prune/delete a snapshot via the command line */
Ask client to create/prune/delete a snapshot via the command line
Ask client to create / prune / delete a snapshot via the command line
int snapshot_cmd(UAContext *ua, const char *cmd)
{
   SNAPSHOT_DBR snapdbr;
   for (int i=0; i<ua->argc; i++) {
      if (strcasecmp(ua->argk[i], NT_("purge")) == 0) {
      } else if (strcasecmp(ua->argk[i], NT_("prune")) == 0) {
         return prune_snapshot(ua);
      } else if (strcasecmp(ua->argk[i], NT_("listclient")) == 0) {
         return list_client_snapshot(ua, false);
      } else if (strcasecmp(ua->argk[i], NT_("list")) == 0) {
         snapshot_list(ua, 0, prtit, HORZ_LIST);
         return 1;
      } else if (strcasecmp(ua->argk[i], NT_("create")) == 0) {
      } else if (strcasecmp(ua->argk[i], NT_("delete")) == 0) {
         return delete_snapshot(ua);
      } else if (strcasecmp(ua->argk[i], NT_("status")) == 0) {
      } else if (strcasecmp(ua->argk[i], NT_("sync")) == 0) {
         return list_client_snapshot(ua, true);
      } else if (strcasecmp(ua->argk[i], NT_("update")) == 0) {
         return update_snapshot(ua);
      } else {
         continue;
      }
   }
   for ( ;; ) {
      start_prompt(ua, _("Snapshot choice: \n"));
      add_prompt(ua, _("List snapshots in Catalog"));
      add_prompt(ua, _("List snapshots on Client"));
      add_prompt(ua, _("Prune snapshots"));
      add_prompt(ua, _("Delete snapshot"));
      add_prompt(ua, _("Update snapshot parameters"));
      add_prompt(ua, _("Update catalog with Client snapshots"));
      add_prompt(ua, _("Done"));
      switch(do_prompt(ua, "", _("Select action to perform on Snapshot Engine"), NULL, 0)) {
      case 0:                         
         snapshot_list(ua, 0, prtit, HORZ_LIST);
         break;
      case 1:                         
         list_client_snapshot(ua, false);
         break;
      case 2:                   
         prune_snapshot(ua);
         break;
      case 3:                   
         delete_snapshot(ua);
         break;
      case 4:                      
         update_snapshot(ua);
         break;
      case 5:                      
         list_client_snapshot(ua, true);
         break;
      case 6:                   
      default:
         ua->info_msg(_("Selection terminated.\n"));
         return 1;
      }
   }
   return 1;
}
int snapshot_cmd ( UAContext * ua , const char * cmd ) { SNAPSHOT_DBR snapdbr ; for ( int i = 0 ; i < ua -> argc ; i ++ ) { if ( strcasecmp ( ua -> argk [ i ] , NT_ ( " " ) ) == 0 ) { } else if ( strcasecmp ( ua -> argk [ i ] , NT_ ( " " ) ) == 0 ) { return prune_snapshot ( ua ) ; } else if ( strcasecmp ( ua -> argk [ i ] , NT_ ( " " ) ) == 0 ) { return list_client_snapshot ( ua , false ) ; } else if ( strcasecmp ( ua -> argk [ i ] , NT_ ( " " ) ) == 0 ) { snapshot_list ( ua , 0 , prtit , HORZ_LIST ) ; return 1 ; } else if ( strcasecmp ( ua -> argk [ i ] , NT_ ( " " ) ) == 0 ) { } else if ( strcasecmp ( ua -> argk [ i ] , NT_ ( " " ) ) == 0 ) { return delete_snapshot ( ua ) ; } else if ( strcasecmp ( ua -> argk [ i ] , NT_ ( " " ) ) == 0 ) { } else if ( strcasecmp ( ua -> argk [ i ] , NT_ ( " " ) ) == 0 ) { return list_client_snapshot ( ua , true ) ; } else if ( strcasecmp ( ua -> argk [ i ] , NT_ ( " " ) ) == 0 ) { return update_snapshot ( ua ) ; } else { continue ; } } for ( ; ; ) { start_prompt ( ua , _ ( " \n " ) ) ; add_prompt ( ua , _ ( " " ) ) ; add_prompt ( ua , _ ( " " ) ) ; add_prompt ( ua , _ ( " " ) ) ; add_prompt ( ua , _ ( " " ) ) ; add_prompt ( ua , _ ( " " ) ) ; add_prompt ( ua , _ ( " " ) ) ; add_prompt ( ua , _ ( " " ) ) ; switch ( do_prompt ( ua , " " , _ ( " " ) , NULL , 0 ) ) { case 0 : snapshot_list ( ua , 0 , prtit , HORZ_LIST ) ; break ; case 1 : list_client_snapshot ( ua , false ) ; break ; case 2 : prune_snapshot ( ua ) ; break ; case 3 : delete_snapshot ( ua ) ; break ; case 4 : update_snapshot ( ua ) ; break ; case 5 : list_client_snapshot ( ua , true ) ; break ; case 6 : default : ua -> info_msg ( _ ( " \n " ) ) ; return 1 ; } } return 1 ; }
Ask client to create/prune/delete a snapshot via the command line
Ask client to create / prune / delete a snapshot via the command line
/* We need a job definition, or a client */ /* list catalog */ /* list client */ /* prune */ /* delete */ /* update snapshot */ /* sync snapshot */ /* done */