mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-21 01:00:48 +00:00
Merge pull request #5204 from proller/fix25
CLICKHOUSE-4511 Fix forcerestart with systemd
This commit is contained in:
commit
31655abc09
@ -56,7 +56,7 @@ if [ "$DATA_DIR_PATTERN" != "$DATA_DIR" ]; then
|
||||
cat $CLICKHOUSE_CONFIG | sed -e s!$DATA_DIR_PATTERN!$DATA_DIR! > $DATA_DIR/etc/server-config.xml
|
||||
export CLICKHOUSE_CONFIG=$DATA_DIR/etc/server-config.xml
|
||||
cp $CLICKHOUSE_CONFIG_USERS $DATA_DIR/etc
|
||||
cp -r -L $CLICKHOUSE_CONFIG_USERS_D $DATA_DIR/etc
|
||||
cp -R -L $CLICKHOUSE_CONFIG_USERS_D $DATA_DIR/etc
|
||||
fi
|
||||
|
||||
CLICKHOUSE_EXTRACT_CONFIG=${CLICKHOUSE_EXTRACT_CONFIG:="${CLICKHOUSE_EXTRACT} --config=$CLICKHOUSE_CONFIG"}
|
||||
|
24
debian/clickhouse-server.init
vendored
24
debian/clickhouse-server.init
vendored
@ -235,10 +235,20 @@ forcestop()
|
||||
}
|
||||
|
||||
|
||||
service_or_func()
|
||||
{
|
||||
if [ -x "/bin/systemctl" ] && [ -f /etc/systemd/system/clickhouse-server.service ] && [ -d /run/systemd/system ]; then
|
||||
service $PROGRAM $1
|
||||
else
|
||||
$1
|
||||
fi
|
||||
}
|
||||
|
||||
forcerestart()
|
||||
{
|
||||
forcestop
|
||||
start
|
||||
# Should not use 'start' function if systemd active
|
||||
service_or_func start
|
||||
}
|
||||
|
||||
use_cron()
|
||||
@ -291,7 +301,9 @@ main()
|
||||
restart && enable_cron
|
||||
;;
|
||||
forcestop)
|
||||
disable_cron && forcestop
|
||||
# disable_cron returns false if cron disabled (with systemd) - not checking return status
|
||||
disable_cron
|
||||
forcestop
|
||||
;;
|
||||
forcerestart)
|
||||
forcerestart && enable_cron
|
||||
@ -300,16 +312,16 @@ main()
|
||||
restart
|
||||
;;
|
||||
condstart)
|
||||
is_running || start
|
||||
is_running || service_or_func start
|
||||
;;
|
||||
condstop)
|
||||
is_running && stop
|
||||
is_running && service_or_func stop
|
||||
;;
|
||||
condrestart)
|
||||
is_running && restart
|
||||
is_running && service_or_func restart
|
||||
;;
|
||||
condreload)
|
||||
is_running && restart
|
||||
is_running && service_or_func restart
|
||||
;;
|
||||
initdb)
|
||||
initdb
|
||||
|
3
debian/clickhouse-server.service
vendored
3
debian/clickhouse-server.service
vendored
@ -7,7 +7,8 @@ User=clickhouse
|
||||
Group=clickhouse
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
ExecStart=/usr/bin/clickhouse-server --config=/etc/clickhouse-server/config.xml
|
||||
RuntimeDirectory=clickhouse-server
|
||||
ExecStart=/usr/bin/clickhouse-server --config=/etc/clickhouse-server/config.xml --pid-file=/run/clickhouse-server/clickhouse-server.pid
|
||||
LimitCORE=infinity
|
||||
LimitNOFILE=500000
|
||||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_IPC_LOCK
|
||||
|
@ -1083,7 +1083,7 @@ void BaseDaemon::initialize(Application & self)
|
||||
}
|
||||
|
||||
/// Create pid file.
|
||||
if (is_daemon && config().has("pid"))
|
||||
if (config().has("pid"))
|
||||
pid.seed(config().getString("pid"));
|
||||
|
||||
/// Change path for logging.
|
||||
|
Loading…
Reference in New Issue
Block a user