| 821 | |
| 822 | |
| 823 | int mainEntryClickHouseStatus(int argc, char ** argv) |
| 824 | { |
| 825 | po::options_description desc; |
| 826 | desc.add_options() |
| 827 | ("help,h", "produce help message") |
| 828 | ("pid-path", po::value<std::string>()->default_value("/var/run/clickhouse-server"), "directory for pid file") |
| 829 | ; |
| 830 | |
| 831 | po::variables_map options; |
| 832 | po::store(po::parse_command_line(argc, argv, desc), options); |
| 833 | |
| 834 | if (options.count("help")) |
| 835 | { |
| 836 | std::cout << "Usage: " |
| 837 | << (getuid() == 0 ? "" : "sudo ") |
| 838 | << argv[0] |
| 839 | << " status\n"; |
| 840 | return 1; |
| 841 | } |
| 842 | |
| 843 | try |
| 844 | { |
| 845 | fs::path pid_file = fs::path(options["pid-path"].as<std::string>()) / "clickhouse-server.pid"; |
| 846 | isRunning(pid_file); |
| 847 | return 0; |
| 848 | } |
| 849 | catch (...) |
| 850 | { |
| 851 | std::cerr << getCurrentExceptionMessage(false) << '\n'; |
| 852 | return getCurrentExceptionCode(); |
| 853 | } |
| 854 | } |
| 855 | |
| 856 | |
| 857 | int mainEntryClickHouseRestart(int argc, char ** argv) |
nothing calls this directly
no test coverage detected