MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / mainEntryClickHouseStop

Function mainEntryClickHouseStop

programs/install/Install.cpp:1310–1347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1308
1309int mainEntryClickHouseStop(int argc, char ** argv);
1310int mainEntryClickHouseStop(int argc, char ** argv)
1311{
1312 try
1313 {
1314 po::options_description desc;
1315 desc.add_options()
1316 ("help,h", "produce help message")
1317 ("prefix", po::value<std::string>()->default_value("/"), "prefix for all paths")
1318 ("pid-path", po::value<std::string>()->default_value("var/run/clickhouse-server"), "directory for pid file")
1319 ("force", po::bool_switch(), "Stop with KILL signal instead of TERM")
1320 ("do-not-kill", po::bool_switch(), "Do not send KILL even if TERM did not help")
1321 ("max-tries", po::value<unsigned>()->default_value(60), "Max number of tries for waiting the server to finish after sending TERM (with 1 second delay)")
1322 ;
1323
1324 po::variables_map options;
1325 po::store(po::parse_command_line(argc, argv, desc), options);
1326
1327 if (options.contains("help"))
1328 {
1329 std::cout << "Usage: " << formatWithSudo("clickhouse stop", getuid() != 0) << " [options]\n";
1330 std::cout << desc << "\n";
1331 return 0;
1332 }
1333
1334 fs::path prefix = options["prefix"].as<std::string>();
1335 fs::path pid_file = prefix / options["pid-path"].as<std::string>() / "clickhouse-server.pid";
1336
1337 bool force = options["force"].as<bool>();
1338 bool do_not_kill = options["do-not-kill"].as<bool>();
1339 unsigned max_tries = options["max-tries"].as<unsigned>();
1340 return stop(pid_file, force, do_not_kill, max_tries);
1341 }
1342 catch (...)
1343 {
1344 std::cerr << getCurrentExceptionMessage(false) << '\n';
1345 return getCurrentExceptionCode();
1346 }
1347}
1348
1349
1350int mainEntryClickHouseStatus(int argc, char ** argv);

Callers

nothing calls this directly

Calls 7

storeFunction · 0.85
formatWithSudoFunction · 0.85
stopFunction · 0.85
getCurrentExceptionCodeFunction · 0.85
add_optionsMethod · 0.80
containsMethod · 0.45

Tested by

no test coverage detected