mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Metrica:
в шаблон init скрипта добавлена логика по отключению крона по команде stop и включению по start
This commit is contained in:
parent
390bf11869
commit
99d487325c
@ -19,6 +19,7 @@
|
|||||||
macro (CREATE_INIT_SCRIPT initname daemonname)
|
macro (CREATE_INIT_SCRIPT initname daemonname)
|
||||||
add_custom_target(${initname}.target ALL
|
add_custom_target(${initname}.target ALL
|
||||||
COMMAND sed -e 's,[@]DAEMON[@],${daemonname},g' < ${PROJECT_SOURCE_DIR}/tools/init.d/template > ${CMAKE_CURRENT_BINARY_DIR}/${initname}
|
COMMAND sed -e 's,[@]DAEMON[@],${daemonname},g' < ${PROJECT_SOURCE_DIR}/tools/init.d/template > ${CMAKE_CURRENT_BINARY_DIR}/${initname}
|
||||||
|
COMMAND sed -i 's,[@]CRONFILE[@],${initname}-metrica-yandex,g' ${CMAKE_CURRENT_BINARY_DIR}/${initname}
|
||||||
COMMAND chmod a+x ${CMAKE_CURRENT_BINARY_DIR}/${initname}
|
COMMAND chmod a+x ${CMAKE_CURRENT_BINARY_DIR}/${initname}
|
||||||
COMMENT "Building ${initname}"
|
COMMENT "Building ${initname}"
|
||||||
)
|
)
|
||||||
|
@ -15,6 +15,7 @@ PIDDIR=/var/run/$PROGRAM
|
|||||||
LOGDIR=/var/log/$PROGRAM
|
LOGDIR=/var/log/$PROGRAM
|
||||||
LOCALSTATEDIR=/var/lock
|
LOCALSTATEDIR=/var/lock
|
||||||
BINDIR=/usr/bin
|
BINDIR=/usr/bin
|
||||||
|
CRONFILE=/etc/cron.d/@CRONFILE@
|
||||||
|
|
||||||
[ -x $BINDIR/$PROGRAM ] || exit 0
|
[ -x $BINDIR/$PROGRAM ] || exit 0
|
||||||
|
|
||||||
@ -91,14 +92,24 @@ restart()
|
|||||||
start
|
start
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enable_cron()
|
||||||
|
{
|
||||||
|
sed -i 's/^#*//' "$CRONFILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
disable_cron()
|
||||||
|
{
|
||||||
|
sed -i 's/^#*/#/' "$CRONFILE"
|
||||||
|
}
|
||||||
|
|
||||||
# See how we were called.
|
# See how we were called.
|
||||||
EXIT_STATUS=0
|
EXIT_STATUS=0
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
start
|
enable_cron && start
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
stop
|
disable_cron && stop
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
isrun && echo "$PROGRAM service is running" || echo "$PROGRAM service is stopped"
|
isrun && echo "$PROGRAM service is running" || echo "$PROGRAM service is stopped"
|
||||||
|
Loading…
Reference in New Issue
Block a user