debian/clickhouse-server.init: systemd proxying for restart/start/stop/reload

This commit is contained in:
Azat Khuzhin 2020-09-04 00:53:21 +03:00
parent b4a1f59ada
commit 3678d3256a

View File

@ -276,13 +276,12 @@ use_cron()
fi fi
return 0 return 0
} }
# returns false if cron disabled (with systemd)
enable_cron() enable_cron()
{ {
use_cron && sed -i 's/^#*//' "$CLICKHOUSE_CRONFILE" use_cron && sed -i 's/^#*//' "$CLICKHOUSE_CRONFILE"
} }
# returns false if cron disabled (with systemd)
disable_cron() disable_cron()
{ {
use_cron && sed -i 's/^#*/#/' "$CLICKHOUSE_CRONFILE" use_cron && sed -i 's/^#*/#/' "$CLICKHOUSE_CRONFILE"
@ -305,15 +304,14 @@ main()
EXIT_STATUS=0 EXIT_STATUS=0
case "$1" in case "$1" in
start) start)
start && enable_cron service_or_func start && enable_cron
;; ;;
stop) stop)
# disable_cron returns false if cron disabled (with systemd) - not checking return status
disable_cron disable_cron
stop service_or_func stop
;; ;;
restart) restart)
restart && enable_cron service_or_func restart && enable_cron
;; ;;
forcestop) forcestop)
disable_cron disable_cron
@ -323,7 +321,7 @@ main()
forcerestart && enable_cron forcerestart && enable_cron
;; ;;
reload) reload)
restart service_or_func restart
;; ;;
condstart) condstart)
is_running || service_or_func start is_running || service_or_func start