public inbox for gentoo-user-ru@lists.gentoo.org
 help / color / mirror / Atom feed
From: Sergey Kobzar <sergey.kobzar@mail.ru>
To: gentoo-user-ru@lists.gentoo.org
Subject: Re: [gentoo-user-ru] Два инстанса Sphinx
Date: Fri, 07 Jun 2013 15:44:56 +0300	[thread overview]
Message-ID: <51B1D5C8.3070901@mail.ru> (raw)
In-Reply-To: <51B19991.4010909@mail.ru>

On 06/07/13 11:28, Sergey Kobzar wrote:

> Угу. Это я ошибся изначально.
> Тестирую. Думаю сегодня будет готово.

Вот что получилось:

/etc/init.d/searchd:

#!/sbin/runscript



cnffile="/etc/sphinx/sphinx`echo ${SVCNAME} | sed 's/searchd//'`.conf"
command="/usr/bin/searchd"
command_args="--config ${cnffile}"
pidfile="/run/${SVCNAME}.pid"


depend() {
         need net
         use logger
}

checkconfig() {
         if [ ! -f ${cnffile} ]; then
                 eerror "Please create ${cnffile}"
                 eerror "Sample conf: /etc/sphinx/sphinx.conf.dist"
                 return 1
         fi
         return 0
}

start() {
         checkconfig || return $?

         ebegin "Starting sphinx searchd"
         start-stop-daemon --start --pidfile ${pidfile} --exec 
${command} -- ${command_args}
         eend $? "Failed to start sphinx searchd"
}

stop() {
         ebegin "Stopping sphinx searchd"
         start-stop-daemon --stop --pidfile ${pidfile} --exec ${command} 
--retry 180
         eend $? "Failed to stop sphinx searchd"
}


/etc/logrotate.d/sphinx ротации log-файлов для нескольких инстансов:

/var/log/sphinx/*.log {
         create 644
         missingok
         sharedscripts
         postrotate
                 find /run/ -maxdepth 1 -type f -name 'searchd*' | \
                         while read pidfile; do
                                 kill -USR1 `cat ${pidfile}`
                         done
         endscript
}


Ну и в ebuild добавить что-то типа:

pkg_postinst() {
	einfo "If you want to run multiple Sphinx instances:"
	einfo "- make a link of /etc/init.d/searchd"
	einfo "- create a copy of /etc/sphinx/sphinx.conf with appropriate name"
	einfo "- Change listen, log, query_log, pid_file and binlog_path in new 
conf file"
	einfo "- Start new instance using appropriate rc script (link)"
}


если нет существенных замечаний, я выкладываю все это дело на 
bugs.gentoo.org.


  reply	other threads:[~2013-06-07 12:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05 22:32 [gentoo-user-ru] Два инстанса Sphinx Sergey Kobzar
2013-06-06  7:02 ` [gentoo-user-ru] " Андрей Буров
2013-06-06 15:16   ` Sergey Kobzar
2013-06-06 17:23     ` [gentoo-user-ru] " Андрей Буров
2013-06-06 18:54       ` [gentoo-user-ru] " Sergey Popov
2013-06-06 19:10         ` [gentoo-user-ru] " Taz
2013-06-06 19:35         ` Sergey Kobzar
2013-06-07  6:22           ` [gentoo-user-ru] " Sergey Popov
2013-06-07  6:23             ` [gentoo-user-ru] " Sergey Popov
2013-06-07  8:28               ` [gentoo-user-ru] " Sergey Kobzar
2013-06-07 12:44                 ` Sergey Kobzar [this message]
2013-06-08 11:39                   ` Sergey Popov
2013-06-09 22:01                     ` Sergey Kobzar
2013-06-10  1:32                       ` [gentoo-user-ru] " Голубев Александр
2013-06-10  8:20                         ` Sergey Kobzar
2013-06-10 20:29                           ` Sergey Kobzar
2013-06-13 11:44                             ` Sergey Kobzar
2013-06-13 17:36                               ` Sergey Popov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51B1D5C8.3070901@mail.ru \
    --to=sergey.kobzar@mail.ru \
    --cc=gentoo-user-ru@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox