|
|
|
@ -167,6 +167,7 @@ main(int argc, char** argv)
|
|
|
|
|
g_printf("-k, --kill kills running sesman\n");
|
|
|
|
|
g_printf("-h, --help shows this help\n");
|
|
|
|
|
g_printf("if no command is specified, sesman is started in background");
|
|
|
|
|
g_deinit();
|
|
|
|
|
g_exit(0);
|
|
|
|
|
}
|
|
|
|
|
else if ((2 == argc) && ((0 == g_strcasecmp(argv[1], "--kill")) ||
|
|
|
|
@ -178,6 +179,7 @@ main(int argc, char** argv)
|
|
|
|
|
if (!g_file_exist(pid_file))
|
|
|
|
|
{
|
|
|
|
|
g_printf("sesman is not running (pid file not found - %s)\n", pid_file);
|
|
|
|
|
g_deinit();
|
|
|
|
|
g_exit(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -194,6 +196,7 @@ main(int argc, char** argv)
|
|
|
|
|
{
|
|
|
|
|
g_printf("error reading pid file: %s\n", g_get_strerror());
|
|
|
|
|
g_file_close(fd);
|
|
|
|
|
g_deinit();
|
|
|
|
|
g_exit(error);
|
|
|
|
|
}
|
|
|
|
|
g_file_close(fd);
|
|
|
|
@ -208,7 +211,7 @@ main(int argc, char** argv)
|
|
|
|
|
{
|
|
|
|
|
g_file_delete(pid_file);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_deinit();
|
|
|
|
|
g_exit(error);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -217,6 +220,7 @@ main(int argc, char** argv)
|
|
|
|
|
g_printf("sesman - xrdp session manager\n\n");
|
|
|
|
|
g_printf("error: invalid command line\n");
|
|
|
|
|
g_printf("usage: sesman [ --nodaemon | --kill | --help ]\n");
|
|
|
|
|
g_deinit();
|
|
|
|
|
g_exit(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -226,6 +230,7 @@ main(int argc, char** argv)
|
|
|
|
|
g_printf("if it's not running, try removing ");
|
|
|
|
|
g_printf(pid_file);
|
|
|
|
|
g_printf("\n");
|
|
|
|
|
g_deinit();
|
|
|
|
|
g_exit(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -234,12 +239,14 @@ main(int argc, char** argv)
|
|
|
|
|
if (0 == g_cfg)
|
|
|
|
|
{
|
|
|
|
|
g_printf("error creating config: quitting.\n");
|
|
|
|
|
g_deinit();
|
|
|
|
|
g_exit(1);
|
|
|
|
|
}
|
|
|
|
|
g_cfg->log.fd = -1; /* don't use logging before reading its config */
|
|
|
|
|
if (0 != config_read(g_cfg))
|
|
|
|
|
{
|
|
|
|
|
g_printf("error reading config: %s\nquitting.\n", g_get_strerror());
|
|
|
|
|
g_deinit();
|
|
|
|
|
g_exit(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -257,6 +264,7 @@ main(int argc, char** argv)
|
|
|
|
|
g_printf("error opening log file [%s]. quitting.\n", g_cfg->log.log_file);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
g_deinit();
|
|
|
|
|
g_exit(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -270,6 +278,7 @@ main(int argc, char** argv)
|
|
|
|
|
|
|
|
|
|
if (0 != g_pid)
|
|
|
|
|
{
|
|
|
|
|
g_deinit();
|
|
|
|
|
g_exit(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -312,6 +321,7 @@ main(int argc, char** argv)
|
|
|
|
|
"error opening pid file[%s]: %s",
|
|
|
|
|
pid_file, g_get_strerror());
|
|
|
|
|
log_end(&(g_cfg->log));
|
|
|
|
|
g_deinit();
|
|
|
|
|
g_exit(1);
|
|
|
|
|
}
|
|
|
|
|
g_sprintf(pid_s, "%d", g_pid);
|
|
|
|
|