mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
CLICKHOUSE-3887 Debian init: Service stop timeout (#5522)
This commit is contained in:
parent
64924f5ef3
commit
a063517091
34
debian/clickhouse-server.init
vendored
34
debian/clickhouse-server.init
vendored
@ -26,14 +26,13 @@ CLICKHOUSE_CRONFILE=/etc/cron.d/clickhouse-server
|
||||
CLICKHOUSE_CONFIG=$CLICKHOUSE_CONFDIR/config.xml
|
||||
LOCKFILE=$LOCALSTATEDIR/$PROGRAM
|
||||
RETVAL=0
|
||||
|
||||
CLICKHOUSE_PIDDIR=/var/run/$PROGRAM
|
||||
CLICKHOUSE_PIDFILE="$CLICKHOUSE_PIDDIR/$PROGRAM.pid"
|
||||
# CLICKHOUSE_STOP_TIMEOUT=60 # Disabled by default. Place to /etc/default/clickhouse if you need.
|
||||
|
||||
# Some systems lack "flock"
|
||||
command -v flock >/dev/null && FLOCK=flock
|
||||
|
||||
|
||||
# Override defaults from optional config file
|
||||
test -f /etc/default/clickhouse && . /etc/default/clickhouse
|
||||
|
||||
@ -76,7 +75,13 @@ is_running()
|
||||
|
||||
wait_for_done()
|
||||
{
|
||||
timeout=$1
|
||||
attempts=0
|
||||
while is_running; do
|
||||
attempts=$(($attempts + 1))
|
||||
if [ -n "$timeout" ] && [ $attempts -gt $timeout ]; then
|
||||
return 1
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
@ -175,7 +180,7 @@ start()
|
||||
|
||||
if [ $EXIT_STATUS -eq 0 ]; then
|
||||
attempts=0
|
||||
while ! is_running && [ $attempts -le 10 ]; do
|
||||
while ! is_running && [ $attempts -le ${CLICKHOUSE_START_TIMEOUT:=10} ]; do
|
||||
attempts=$(($attempts + 1))
|
||||
sleep 1
|
||||
done
|
||||
@ -194,7 +199,7 @@ start()
|
||||
|
||||
stop()
|
||||
{
|
||||
local EXIT_STATUS
|
||||
#local EXIT_STATUS
|
||||
EXIT_STATUS=0
|
||||
|
||||
if [ -f $CLICKHOUSE_PIDFILE ]; then
|
||||
@ -203,10 +208,14 @@ stop()
|
||||
|
||||
kill -TERM $(cat "$CLICKHOUSE_PIDFILE")
|
||||
|
||||
wait_for_done
|
||||
|
||||
if ! wait_for_done ${CLICKHOUSE_STOP_TIMEOUT}; then
|
||||
EXIT_STATUS=2
|
||||
echo "TIMEOUT"
|
||||
else
|
||||
echo "DONE"
|
||||
fi
|
||||
|
||||
fi
|
||||
return $EXIT_STATUS
|
||||
}
|
||||
|
||||
@ -214,8 +223,12 @@ stop()
|
||||
restart()
|
||||
{
|
||||
check_config
|
||||
stop
|
||||
start
|
||||
if stop; then
|
||||
if start; then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
@ -295,13 +308,14 @@ main()
|
||||
start && enable_cron
|
||||
;;
|
||||
stop)
|
||||
disable_cron && stop
|
||||
# disable_cron returns false if cron disabled (with systemd) - not checking return status
|
||||
disable_cron
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
restart && enable_cron
|
||||
;;
|
||||
forcestop)
|
||||
# disable_cron returns false if cron disabled (with systemd) - not checking return status
|
||||
disable_cron
|
||||
forcestop
|
||||
;;
|
||||
|
4
debian/pbuilder-hooks/A00ccache
vendored
4
debian/pbuilder-hooks/A00ccache
vendored
@ -12,6 +12,10 @@ if [ -n "$CCACHE_DIR" ]; then
|
||||
chmod -R a+rwx $CCACHE_DIR $DISTCC_DIR ||:
|
||||
fi
|
||||
|
||||
[ $CCACHE_PREFIX = 'distcc' ] && mkdir -p ~/.distcc && echo "localhost/`nproc`" >> ~/.distcc/hosts
|
||||
# [ $CCACHE_PREFIX = 'distcc' ] && mkdir -p /etc/distcc/ && echo "localhost/`nproc`" >> /etc/distcc/hosts
|
||||
# distcc --show-hosts
|
||||
|
||||
df -h
|
||||
ccache --show-stats
|
||||
ccache --zero-stats
|
||||
|
Loading…
Reference in New Issue
Block a user