Improve conf and conf testing
This commit is contained in:
18
src/main.c
18
src/main.c
@@ -34,9 +34,11 @@ static void usage(char *argv)
|
||||
{
|
||||
fprintf(stderr, "Usage:\n%s TASK [-c CONFIG] [-d]\n\n"
|
||||
"Tasks:\n"
|
||||
"\t--start\t\tStart the RMPS server.\n"
|
||||
"\t--start\t\tStart the RMPS server. This is by default. \n"
|
||||
"\t--stop\t\tStop the RMPS server.\n"
|
||||
"\t--restart\tRestart the RMPS server.\n\n"
|
||||
"\t--restart\tRestart the RMPS server.\n"
|
||||
"\t-t, --test\tTest the configuration file and exit,\n"
|
||||
"\t-T\t\tTest the configuration file, dump it to stdout and exit.\n"
|
||||
"Options:\n"
|
||||
"\t-c, --config\n"
|
||||
"\t\tSpecify the configuration file path. Default is set "
|
||||
@@ -53,10 +55,12 @@ int main(int argc, char *argv[])
|
||||
enum tasks {
|
||||
START = 1,
|
||||
STOP,
|
||||
RESTART
|
||||
RESTART,
|
||||
TEST,
|
||||
TEST_AND_EXPORT
|
||||
};
|
||||
static int task;
|
||||
const char opts_short[] = "dc:h";
|
||||
static int task = START;
|
||||
const char opts_short[] = "dc:htT";
|
||||
static struct option opts_long[] =
|
||||
{
|
||||
{"start", no_argument, &task, START},
|
||||
@@ -112,14 +116,14 @@ int main(int argc, char *argv[])
|
||||
log(VERBOSE, "Conf parser finished successfully");
|
||||
//confexport();
|
||||
|
||||
if (task == STOP|| task == RESTART) {
|
||||
if (task == STOP || task == RESTART) {
|
||||
char buf[10];
|
||||
int pid;
|
||||
FILE *fp;
|
||||
|
||||
if (task == STOP)
|
||||
log(VERBOSE, "We got a stop signal!");
|
||||
else if (task == RESTART)
|
||||
else /* RESTART */
|
||||
log(VERBOSE, "We got a restart signal!");
|
||||
|
||||
fp = fopen(conf.rmps.pidfile, "r");
|
||||
|
||||
Reference in New Issue
Block a user