1 |
On 06/06/13 21:54, Sergey Popov wrote: |
2 |
> 06.06.2013 21:23, Андрей Буров пишет: |
3 |
>> Для первого у Вас должно быть |
4 |
>> start-stop-daemon --stop --pidfile /run/searchd-first.pid |
5 |
>> для второго: |
6 |
>> start-stop-daemon --stop --pidfile /run/searchd-second.pid |
7 |
>> |
8 |
>> start-stop-daemon --stop --exec /usr/bin/searchd и должен убивать |
9 |
>> Все searchd |
10 |
>> |
11 |
>> |
12 |
>> 2013/6/6 Sergey Kobzar <sergey.kobzar@××××.ru |
13 |
>> <mailto:sergey.kobzar@××××.ru>> |
14 |
>> |
15 |
>> On 06/06/13 10:02, Андрей Буров wrote: |
16 |
>> |
17 |
>> Доброго времени суток |
18 |
>> Поменяйте в скриптах: |
19 |
>> start: |
20 |
>> start-stop-daemon --start --make-pidfile --pidfile |
21 |
>> /var/run/sphinx-test.pid --exec /usr/bin/searchd -- --config |
22 |
>> /etc/sphinx/sphinx-test.conf |
23 |
>> |
24 |
>> stop: |
25 |
>> start-stop-daemon --stop --pidfile /var/run/sphinx-test.pid |
26 |
>> |
27 |
>> |
28 |
>> Сделал. Все-равно /etc/init.d/searchd stop останавливает 2 процесса. |
29 |
>> |
30 |
>> После старта (запускаются демоны разными скриптами): |
31 |
>> 21467 ? S 0:00 /usr/bin/searchd |
32 |
>> 21468 ? Sl 0:00 /usr/bin/searchd |
33 |
>> 21485 ? S 0:00 /usr/bin/searchd --config |
34 |
>> /etc/sphinx/sphinx-test.conf |
35 |
>> 21486 ? Sl 0:18 /usr/bin/searchd --config |
36 |
>> /etc/sphinx/sphinx-test.conf |
37 |
>> |
38 |
>> |
39 |
>> Оригинальный скрипт /etc/init.d/searchd: |
40 |
>> #!/sbin/runscript |
41 |
>> # Copyright 1999-2004 Gentoo Foundation |
42 |
>> # Distributed under the terms of the GNU General Public License v2 |
43 |
>> # $Header: |
44 |
>> /var/cvsroot/gentoo-x86/app-__misc/sphinx/files/searchd.rc,v 1.1 |
45 |
>> 2009/11/05 15:41:56 graaff Exp $ |
46 |
>> |
47 |
>> |
48 |
>> depend() { |
49 |
>> need net |
50 |
>> use logger |
51 |
>> } |
52 |
>> |
53 |
>> checkconfig() { |
54 |
>> if [ ! -f /etc/sphinx/sphinx.conf ] ; then |
55 |
>> eerror "Please create /etc/sphinx/sphinx.conf" |
56 |
>> |
57 |
>> eerror "Sample conf: /etc/sphinx/sphinx.conf.dist" |
58 |
>> return 1 |
59 |
>> fi |
60 |
>> return 0 |
61 |
>> } |
62 |
>> |
63 |
>> start() { |
64 |
>> checkconfig || return $? |
65 |
>> |
66 |
>> ebegin "Starting sphinx searchd" |
67 |
>> start-stop-daemon --start --exec /usr/bin/searchd |
68 |
>> eend $? "Failed to start sphinx searchd" |
69 |
>> } |
70 |
>> |
71 |
>> stop() { |
72 |
>> ebegin "Stopping sphinx searchd" |
73 |
>> start-stop-daemon --stop --exec /usr/bin/searchd |
74 |
>> eend $? "Failed to stop sphinx searchd" |
75 |
>> } |
76 |
>> |
77 |
>> Скрипт для второго инстанса /etc/init.d/searchd-test: |
78 |
>> #!/sbin/runscript |
79 |
>> |
80 |
>> |
81 |
>> |
82 |
>> depend() { |
83 |
>> need net |
84 |
>> use logger |
85 |
>> } |
86 |
>> |
87 |
>> checkconfig() { |
88 |
>> if [ ! -f /etc/sphinx/sphinx-test.conf ]; then |
89 |
>> eerror "Please create /etc/sphinx/sphinx-test.conf" |
90 |
>> eerror "Sample conf: /etc/sphinx/sphinx.conf.dist" |
91 |
>> return 1 |
92 |
>> fi |
93 |
>> return 0 |
94 |
>> } |
95 |
>> |
96 |
>> start() { |
97 |
>> checkconfig || return $? |
98 |
>> |
99 |
>> ebegin "Starting sphinx searchd" |
100 |
>> start-stop-daemon --start --make-pidfile --pidfile |
101 |
>> /run/searchd-test.pid --exec /usr/bin/searchd -- --config |
102 |
>> /etc/sphinx/sphinx-test.conf |
103 |
>> |
104 |
>> eend $? "Failed to start sphinx searchd" |
105 |
>> } |
106 |
>> |
107 |
>> stop() { |
108 |
>> ebegin "Stopping sphinx searchd" |
109 |
>> start-stop-daemon --stop --pidfile /run/searchd-test.pid |
110 |
>> |
111 |
>> eend $? "Failed to stop sphinx searchd" |
112 |
>> } |
113 |
>> |
114 |
>> |
115 |
>> Может первому первому скрпту надо сказат --make-pidfile --pidfile |
116 |
>> /run/searchd-test.pid? |
117 |
>> |
118 |
>> Кстати, а зачем --make-pidfile, если демон сам их создает: |
119 |
>> |
120 |
>> # cat /etc/sphinx/sphinx.conf | grep pid |
121 |
>> pid_file = /run/searchd.pid |
122 |
>> |
123 |
>> # cat /etc/sphinx/sphinx-test.conf | grep pid |
124 |
>> pid_file = /run/searchd-test.pid |
125 |
>> |
126 |
>> ? |
127 |
> |
128 |
> Извините, что встреваю, но данное действие можно сделать одним |
129 |
> init-скриптом и симлинком на него(оригинальный скрипт, понятное дело |
130 |
> прийдется изменить). conf.d файла нужно будет 2(например sphinx и |
131 |
> sphinx.test, соответственно скрипт будет sphinx а симлинк - sphinx.test. |
132 |
> Разруливать всё это можно будет через переменную ${SVCNAME}). А патч |
133 |
> отправить на bugs.gentoo.org. Если активности в баге особой не будет - |
134 |
> можно будет аккуратно пнуть мэйнтэйнеров. Я поспособствую ;-) |
135 |
> |
136 |
> В чем преимущество? В том, что в данной схеме можно будет запустить |
137 |
> 3,5,10,сколько_позволит_железо копий sphinx |
138 |
> |
139 |
|
140 |
Согласен. Только портами, PID'ами и расположением индексов все-таки |
141 |
удобнее рулить через /etc/sphinx(-*).conf |
142 |
|
143 |
Держать сущность в 2х и более местах смысла не вижу. |
144 |
|
145 |
В общем в посижу, разберусь. Посмотри что из этого получится. |