в шаблон init скрипта добавлена логика по отключению крона по команде stop и включению по start
This commit is contained in:
Michael Razuvaev 2009-04-03 14:48:11 +00:00
parent 390bf11869
commit 99d487325c
2 changed files with 14 additions and 2 deletions

View File

@ -19,6 +19,7 @@
macro (CREATE_INIT_SCRIPT initname daemonname)
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 -i 's,[@]CRONFILE[@],${initname}-metrica-yandex,g' ${CMAKE_CURRENT_BINARY_DIR}/${initname}
COMMAND chmod a+x ${CMAKE_CURRENT_BINARY_DIR}/${initname}
COMMENT "Building ${initname}"
)

View File

@ -15,6 +15,7 @@ PIDDIR=/var/run/$PROGRAM
LOGDIR=/var/log/$PROGRAM
LOCALSTATEDIR=/var/lock
BINDIR=/usr/bin
CRONFILE=/etc/cron.d/@CRONFILE@
[ -x $BINDIR/$PROGRAM ] || exit 0
@ -91,14 +92,24 @@ restart()
start
}
enable_cron()
{
sed -i 's/^#*//' "$CRONFILE"
}
disable_cron()
{
sed -i 's/^#*/#/' "$CRONFILE"
}
# See how we were called.
EXIT_STATUS=0
case "$1" in
start)
start
enable_cron && start
;;
stop)
stop
disable_cron && stop
;;
status)
isrun && echo "$PROGRAM service is running" || echo "$PROGRAM service is stopped"