| 786 | |
| 787 | |
| 788 | int mainEntryClickHouseStop(int argc, char ** argv) |
| 789 | { |
| 790 | po::options_description desc; |
| 791 | desc.add_options() |
| 792 | ("help,h", "produce help message") |
| 793 | ("pid-path", po::value<std::string>()->default_value("/var/run/clickhouse-server"), "directory for pid file") |
| 794 | ("force", po::bool_switch(), "Stop with KILL signal instead of TERM") |
| 795 | ; |
| 796 | |
| 797 | po::variables_map options; |
| 798 | po::store(po::parse_command_line(argc, argv, desc), options); |
| 799 | |
| 800 | if (options.count("help")) |
| 801 | { |
| 802 | std::cout << "Usage: " |
| 803 | << (getuid() == 0 ? "" : "sudo ") |
| 804 | << argv[0] |
| 805 | << " stop\n"; |
| 806 | return 1; |
| 807 | } |
| 808 | |
| 809 | try |
| 810 | { |
| 811 | fs::path pid_file = fs::path(options["pid-path"].as<std::string>()) / "clickhouse-server.pid"; |
| 812 | |
| 813 | return stop(pid_file, options["force"].as<bool>()); |
| 814 | } |
| 815 | catch (...) |
| 816 | { |
| 817 | std::cerr << getCurrentExceptionMessage(false) << '\n'; |
| 818 | return getCurrentExceptionCode(); |
| 819 | } |
| 820 | } |
| 821 | |
| 822 | |
| 823 | int mainEntryClickHouseStatus(int argc, char ** argv) |
nothing calls this directly
no test coverage detected