| 1349 | |
| 1350 | int mainEntryClickHouseStatus(int argc, char ** argv); |
| 1351 | int mainEntryClickHouseStatus(int argc, char ** argv) |
| 1352 | { |
| 1353 | try |
| 1354 | { |
| 1355 | po::options_description desc; |
| 1356 | desc.add_options() |
| 1357 | ("help,h", "produce help message") |
| 1358 | ("prefix", po::value<std::string>()->default_value("/"), "prefix for all paths") |
| 1359 | ("pid-path", po::value<std::string>()->default_value("var/run/clickhouse-server"), "directory for pid file") |
| 1360 | ; |
| 1361 | |
| 1362 | po::variables_map options; |
| 1363 | po::store(po::parse_command_line(argc, argv, desc), options); |
| 1364 | |
| 1365 | if (options.contains("help")) |
| 1366 | { |
| 1367 | std::cout << "Usage: " << formatWithSudo("clickhouse status", getuid() != 0) << " [options]\n"; |
| 1368 | std::cout << desc << "\n"; |
| 1369 | return 0; |
| 1370 | } |
| 1371 | |
| 1372 | fs::path prefix = options["prefix"].as<std::string>(); |
| 1373 | fs::path pid_file = prefix / options["pid-path"].as<std::string>() / "clickhouse-server.pid"; |
| 1374 | |
| 1375 | isRunning(pid_file, /*ignore_file_does_not_exist=*/ false); |
| 1376 | } |
| 1377 | catch (...) |
| 1378 | { |
| 1379 | std::cerr << getCurrentExceptionMessage(false) << '\n'; |
| 1380 | return getCurrentExceptionCode(); |
| 1381 | } |
| 1382 | |
| 1383 | return 0; |
| 1384 | } |
| 1385 | |
| 1386 | |
| 1387 | int mainEntryClickHouseRestart(int argc, char ** argv); |
nothing calls this directly
no test coverage detected