mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
Allow to override umask in config [#CLICKHOUSE-2].
This commit is contained in:
parent
c720524078
commit
4687a2730d
@ -114,6 +114,11 @@
|
||||
-->
|
||||
<!-- <timezone>Europe/Moscow</timezone> -->
|
||||
|
||||
<!-- You can specify umask here (see "man umask"). Server will apply it on startup.
|
||||
Number is always parsed as octal. Default umask is 027 (other users cannot read logs, data files, etc; group can only read).
|
||||
-->
|
||||
<!-- <umask>022</umask> -->
|
||||
|
||||
<!-- Configuration of clusters that could be used in Distributed tables.
|
||||
https://clickhouse.yandex/reference_en.html#Distributed
|
||||
-->
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
void buildLoggers();
|
||||
|
||||
/// Определяет параметр командной строки
|
||||
void defineOptions(Poco::Util::OptionSet& _options) override;
|
||||
void defineOptions(Poco::Util::OptionSet & _options) override;
|
||||
|
||||
/// Заставляет демон завершаться, если хотя бы одна задача завершилась неудачно
|
||||
void exitOnTaskError();
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <memory>
|
||||
#include <Poco/Observer.h>
|
||||
#include <Poco/Logger.h>
|
||||
@ -691,7 +692,7 @@ std::string BaseDaemon::getDefaultCorePath() const
|
||||
return "/opt/cores/";
|
||||
}
|
||||
|
||||
void BaseDaemon::initialize(Application& self)
|
||||
void BaseDaemon::initialize(Application & self)
|
||||
{
|
||||
task_manager.reset(new Poco::TaskManager);
|
||||
ServerApplication::initialize(self);
|
||||
@ -740,6 +741,18 @@ void BaseDaemon::initialize(Application& self)
|
||||
tzset();
|
||||
}
|
||||
|
||||
/// This must be done before creation of any files (including logs).
|
||||
if (config().has("umask"))
|
||||
{
|
||||
std::string umask_str = config().getString("umask");
|
||||
mode_t umask_num = 0;
|
||||
std::stringstream stream;
|
||||
stream << umask_str;
|
||||
stream >> std::oct >> umask_num;
|
||||
|
||||
umask(umask_num);
|
||||
}
|
||||
|
||||
std::string log_path = config().getString("logger.log", "");
|
||||
if (!log_path.empty())
|
||||
log_path = Poco::Path(log_path).setFileName("").toString();
|
||||
|
Loading…
Reference in New Issue
Block a user