Fix: check for a session daemon before running load command
[lttng-tools.git] / src / bin / lttng / commands / load.c
index 7a29da52da3ed780dfff56970678a5750bf3f970..64dc0fca68c8c88f43d8c369defd28fc85c44fb9 100644 (file)
@@ -53,24 +53,6 @@ static struct poptOption load_opts[] = {
        {0, 0, 0, 0, 0, 0, 0}
 };
 
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
-       fprintf(ofp, "usage: lttng load [OPTIONS] [SESSION]\n");
-       fprintf(ofp, "\n");
-       fprintf(ofp, "Options:\n");
-       fprintf(ofp, "  -h, --help               Show this help\n");
-       fprintf(ofp, "  -a, --all                Load all sessions (default)\n");
-       fprintf(ofp, "  -i, --input-path PATH    Input path of the session file(s).\n");
-       fprintf(ofp, "                           If a directory, load all files in it\n");
-       fprintf(ofp, "                           else try to load the given file.\n");
-       fprintf(ofp, "  -f, --force              Override existing session(s).\n");
-       fprintf(ofp, "                           This will destroy existing session(s)\n");
-       fprintf(ofp, "                           before creating new one(s).\n");
-}
-
 static int mi_partial_session(const char *session_name)
 {
        int ret;
@@ -163,12 +145,19 @@ int cmd_load(int argc, const char **argv)
                        opt_force = 1;
                        break;
                default:
-                       usage(stderr);
                        ret = CMD_UNDEFINED;
                        goto end;
                }
        }
 
+       ret = lttng_session_daemon_alive();
+       if (!ret) {
+               ERR("No session daemon is available");
+               ret = CMD_ERROR;
+               goto end;
+       }
+       ret = 0;
+
        if (!opt_load_all) {
                session_name = poptGetArg(pc);
                if (session_name) {
This page took 0.026852 seconds and 4 git commands to generate.