src/dird/job.c
bool run_console_command(JCR *jcr, const char *cmd)
{
   UAContext *ua;
   bool ok;
   JCR *ljcr = new_control_jcr("-RunScript-", JT_CONSOLE);
   ua = new_ua_context(ljcr);
   /* run from runscript and check if commands are authorized */
   ua->runscript = true;
   Mmsg(ua->cmd, "%s", cmd);
   Dmsg1(100, "Console command: %s\n", ua->cmd);
   parse_ua_args(ua);
   if (ua->argc > 0 && ua->argk[0][0] == '.') {
      ok = do_a_dot_command(ua);
   } else {
     ok = do_a_command(ua);
   }
   close_db(ua);
   free_ua_context(ua);
   free_jcr(ljcr);
   return ok;
}
/* TODO: redirect command ouput to job log */
redirect command ouput to job log
redirect command ouput to job log
bool run_console_command(JCR *jcr, const char *cmd)
{
   UAContext *ua;
   bool ok;
   JCR *ljcr = new_control_jcr("-RunScript-", JT_CONSOLE);
   ua = new_ua_context(ljcr);
   ua->runscript = true;
   Mmsg(ua->cmd, "%s", cmd);
   Dmsg1(100, "Console command: %s\n", ua->cmd);
   parse_ua_args(ua);
   if (ua->argc > 0 && ua->argk[0][0] == '.') {
      ok = do_a_dot_command(ua);
   } else {
     ok = do_a_command(ua);
   }
   close_db(ua);
   free_ua_context(ua);
   free_jcr(ljcr);
   return ok;
}
bool run_console_command ( JCR * jcr , const char * cmd ) { UAContext * ua ; bool ok ; JCR * ljcr = new_control_jcr ( " " , JT_CONSOLE ) ; ua = new_ua_context ( ljcr ) ; ua -> runscript = true ; Mmsg ( ua -> cmd , " " , cmd ) ; Dmsg1 ( 100 , " \n " , ua -> cmd ) ; parse_ua_args ( ua ) ; if ( ua -> argc > 0 && ua -> argk [ 0 ] [ 0 ] == ' ' ) { ok = do_a_dot_command ( ua ) ; } else { ok = do_a_command ( ua ) ; } close_db ( ua ) ; free_ua_context ( ua ) ; free_jcr ( ljcr ) ; return ok ; }
TODO: redirect command ouput to job log
TODO : redirect command ouput to job log
/* run from runscript and check if commands are authorized */