if (pool_get_config(conf_file))
{
pool_error("Unable to get configuration. Exiting...");
- mypid = getpid();
+ mypid = 0; /* do not delete UNIX domain socket or pid file */
myexit(1);
}
(pool_config.weight_master + pool_config.weight_secondary));
pool_debug("weight: %ld", weight_master);
+ /*
+ * if a non-switch argument remains, then it should be either "stop" or "switch"
+ */
if (optind == (argc - 1))
{
if (!strcmp(argv[optind], "stop"))
switch_me();
exit(0);
}
+ else
+ {
+ usage();
+ exit(1);
+ }
}
+ /*
+ * else if no non-switch argument remains, then it should be a start request
+ */
else if (optind == argc)
{
pid = read_pid_file();
fprintf(stderr, "pid file found but it seems bogus. Trying to start pgpool anyway...\n");
}
}
- else if (optind < argc)
+ /*
+ * otherwise an error...
+ */
+ else
{
usage();
exit(1);
}
-
/* set signal masks */
poolinitmask();